Image coding device, digital still camera, digital camcorder, imaging device, and image coding method

ABSTRACT

Coding processing performed by an image coding device ( 100 ) includes: processing (S 133 ) of performing coding by leaving surplus bit(s), when the digit number B of binary data of the difference value between (a) a value of a to-be-coded pixel and (b) a prediction value is smaller than the predetermined bit number M; and processing (S 133 ) of performing coding by using the surplus bit(s), when the digit number B is greater than M and there are the surplus bit(s). Pieces of coded data each having a predetermined coding amount are generated, by performing processing for each of consecutive T pixels so as to perform the coding processing for each of U pixels among the consecutive T pixels (S 136 ).

CROSS REFERENCE TO RELATED APPLICATION(S)

This is a continuation application of PCT application No.PCT/JP2009/004642 filed on Sep. 16, 2009, designating the United Statesof America.

BACKGROUND OF THE INVENTION

(1) Field of the Invention

The present invention relates to devices and methods for coding image.

(2) Description of the Related Art

In resent years, with the increase of pixels in imaging devices used inimage capturing apparatuses such as digital still cameras and digitalcamcorders, an amount of image data processed by an integrated circuitembedded in such an apparatus has been increased. In order to allow theintegrated circuit in the image capturing apparatus to handle a largeamount of image data, speeding-up of operation frequency, increase of amemory capacity, and the like are considered to secure a bus width ofdata transfer in the integrated circuit. However, the above resultsdirectly in cost increase.

Moreover, in general, after the integrated circuit completes all imageprocessing, the image capturing apparatus such as a digital still cameraor a digital camcorder performs compression processing for the imagedata when the image data is to be recorded onto an external recordingdevice such as a memory card. After that, the image capturing apparatusrecords the compressed data generated by the compression processing ontothe external recording device. In the compression processing, a codingmethod such as Joint Photographic Experts Group (JPEG) or Moving PictureExperts Group (MPEG) is used. Therefore, it is possible to record, ontothe external recording device, image data with a size larger or with anamount larger than the case where the image data is not compressed.

Patent Reference 1 discloses a technique of performing such image datacompression processing, not only for data for which image processing hasbeen performed, but also for pixel signals (raw data) provided from animaging device. This technique makes it possible to increase the numberof continuous capturing pictures of the same size for the same memorycapacity. In addition, Patent Reference 1 discloses a digital signalcompression coding device and a digital signal decoding device, each ofwhich does not need a memory to realize a high compression rate in astate where a low coding operation processing load is secured.

On the other hand, Patent Reference 2 discloses an image coding devicecapable of printing, at high accuracy and at high speed, a print objecton which various pieces of image data having different properties aremixed, such as a poster or an advertisement on which single-colorcharacters or graphics are included in a natural image such as aphotograph. Since image properties of the characters or graphics differfrom image properties of the natural image, adoption of the same codingmethod deteriorates image quality.

The image coding device disclosed in Patent Reference 2 includes anirreversible coding unit for coding pixel data by fixed length codes, areversible coding unit, a surplus code counter, and a coding controlunit.

When a compression rate of pixel data of a to-be-coded pixel is higherthan a specified compression rate, the reversible coding unit codes thepixel data of the to-be-coded pixel by leaving surplus code(s) fromfixed length codes. On the other hand, when a compression rate of pixeldata of a to-be-coded pixel is lower than the specified compressionrate, the reversible coding unit codes the pixel data of the to-be-codedpixel by consuming the surplus code(s) added to the fixed length codes.

The surplus code counter counts up the surplus code(s) from the fixedlength codes when the reversible coding unit codes the image data, andcounts down the surplus code(s) consumed by the reversible coding unit.The coding control unit performs processing for continuing codingoperations of the reversible coding unit, in a range where a count valueof a surplus counter is not lower than the specified compression rate.The image coding device performing the above-described processing canimprove data reproducibility.

Patent References

-   Patent Reference 1: Japanese Unexamined Patent Application    Publication No. 2007-036566-   Patent Reference 2: Japanese Unexamined Patent Application    Publication No. 2007-181051

DISCLOSURE OF INVENTION Problems that Invention is to Solve

However, the digital signal compression coding device disclosed inPatent Reference 1, a zone quantization width determination unit 201shown in FIG. 21 quantizes, by a fixed quantization width (zonequantization width), each pixel value included in a “zone” that means agroup of neighboring pixels.

The zone quantization width is equal to a difference between (a) a valuewhich corresponds to a maximum pixel value difference and is calculatedby adding 1 to a quantization range value and (b) the number ofcompression coding pixel data bits (s). Here, the maximum pixel valuedifference is a maximum value of a difference value (hereinafter,referred to as a “pixel difference value”) between a value of each pixelincluded in a zone and a value of a neighboring same-color pixel.Furthermore, the quantization range value represents the number ofdigits required to express an absolute value of the pixel differencevalue by binary number. Moreover, the number of compression coding pixeldata bits (s) is the number of bits of data generated by performingcompression coding for pixel value data.

Thereby, even if a sharp edge exists in the zone and only a differencevalue of a certain single pixel is large, all pixels in the same zoneare influenced by it and the quantization width is increased. Therefore,the digital signal compression coding device disclosed in PatentReference 1 causes quantization errors more than necessary, even if adifference value is small and quantization is not so necessary. As aresult, there is a problem that a degree of deterioration of imagequality is large.

On the other hand, in the image coding device disclosed in PatentReference 2, a surplus code counter 301 shown in FIG. 22 counts up ordown surplus code(s) from or added to the fixed length codes, andmanages the counted count value. Thereby, the image coding devicecontrols the reversible coding processing to be continued.

In addition, in the reversible coding processing, if a value of ato-be-coded pixel X is registered in a dictionary, an index of the valuein the dictionary is coded. If the value of the to-be-coded pixel X isnot registered in the dictionary, a neighboring pixel value evaluationunit 302 calculates a correlation among a plurality of pixels (P, A, B)positioned prior and subsequent to the to-be-coded pixel, and codes acode indicating the correlation.

In other words, if the value of the to-be-coded pixel X is notregistered in the dictionary, the to-be-coded pixel X and the pluralityof codes prior and subsequent to the to-be-coded pixel X are coded bythe same code. Therefore, if the reversible coding processing disclosedin Patent Reference 2 is performed, the coded data is expressed by avariable length. In other words, the data coded by the reversible codingprocessing disclosed in Patent Reference 2 is variable length codeddata. Therefore, when decoding the variable length coded data, the datais traced from a beginning of the compressed variable length coded datain the same order as the image scanning order used in the codingprocessing.

On the other hand, in image processing performed by integrated circuitgenerally embedded in a digital still camera or the like, digital pixelsignals provided from an imaging device are temporarily stored in amemory such as a Synchronous Dynamic Random Access Memory (SDRAM). Then,the integrated circuit performs, for the temporarily stored data,predetermined image processing, YC signal generation processing, zoomprocessing such as enlarging and reducing, and the like. After that, theintegrated circuit temporarily stores the resulting data into the SDRAMagain.

In the above processing, for example, when image of a desired region isto be cut out from the stored image, when image processing requiringreference/correlation between above and below pixels is to be performed,it is often required to read pixel data of the desired region from thememory. In this case, if the image data stored in the memory is variablelength coded data, it is impossible to specify the region where imagedata of the desired region is stored. In other words, the image data ofthe desired region cannot be read from the memory. Therefore, if theimage data stored in the memory is variable length coded data, randomaccessibility is lost.

The present invention is made to solve the above-described problems. Anobject of the present invention is to provide an image coding device andthe like which are capable of reducing a degree of deterioration ofimage quality, while keeping random accessibility

SUMMARY OF THE INVENTION

In accordance with an aspect of the present invention for solving theabove-described problems, there is provided an image coding device thatcodes image, the image coding device performing coding processing forcoding image, the image including a plurality of pixels which arepreviously ordered, the coding processing including: when a digit numberB of binary data of a difference value between (a) a value of ato-be-coded pixel that is a pixel to be coded and (b) a prediction valuethat is a value generated by predicting the value of the to-be-codedpixel is smaller than a predetermined bit number M, processing of codingthe difference value corresponding to the digit number B smaller than Mby leaving J surplus bit which are calculated by M−B; and when the digitnumber B is greater than M and there are K surplus bit, processing ofcoding the difference value corresponding to the digit number B greaterthan M by using L surplus bit, where L≦K, and the image coding devicegenerating pieces of coded data each having a predetermined codingamount, by performing processing for each of consecutive T pixels, whereT≧2, among the plurality of pixels so as to perform the codingprocessing for each of U pixels, where U≦T, among the consecutive Tpixels, wherein the pieces of coded data each having the predeterminedcoding amount are pieces of data necessary to reconstruct the image, andeach of the pieces of coded data each having the predetermined codingamount is a piece of data necessary to reconstruct the corresponding Tpixels.

More specifically, the coding processing performed by the image codingdevice includes: performing coding by leaving surplus bit(s), when thedigit number B of binary data of the difference value between (a) avalue of a to-be-coded pixel and (b) a prediction value is smaller thanthe predetermined bit number M; and performing coding by using thesurplus bit(s), when the digit number B is greater than M and there arethe surplus bit(s). Pieces of coded data each having a predeterminedcoding amount are generated, by performing processing for each ofconsecutive T pixels so as to perform the coding processing for each ofU pixels among the consecutive T pixels. The pieces of coded data eachhaving the predetermined coding amount are pieces of data necessary toreconstruct the image.

Therefore, since surplus bit(s) is used to perform coding when there isthe surplus bit(s), it is possible to reduce a degree of deteriorationof image quality of the image which is caused by coding. In addition,pieces of coded data each having a predetermined coding amount aregenerated. Therefore, if the generated pieces of coded data each havingthe predetermined coding amount are stored into a memory or the like, itis possible to easily specify a piece of coded data corresponding to apixel at a specific position in the image. As a result, randomaccessibility for the pieces of coded data can be kept.

Therefore, the present invention can reduce a degree of deterioration ofimage quality of the image while keeping random accessibility.

Effects of the Invention

An image coding device codes image, the image coding device performingcoding processing for coding image, the image including a plurality ofpixels which are previously ordered, the coding processing including:when a digit number B of binary data of a difference value between (a) avalue of a to-be-coded pixel that is a pixel to be coded and (b) aprediction value that is a value generated by predicting the value ofthe to-be-coded pixel is smaller than a predetermined bit number M,processing of coding the difference value corresponding to the digitnumber B smaller than M by leaving J surplus bit which are calculated byM−B; and when the digit number B is greater than M and there are Ksurplus bit, processing of coding the difference value corresponding tothe digit number B greater than M by using L surplus bit, where L≦K, andthe image coding device generating pieces of coded data each having apredetermined coding amount, by performing processing for each ofconsecutive T pixels, where T≧2, among the plurality of pixels so as toperform the coding processing for each of U pixels, where U≦T, among theconsecutive T pixels, wherein the pieces of coded data each having thepredetermined coding amount are pieces of data necessary to reconstructthe image, and each of the pieces of coded data each having thepredetermined coding amount is a piece of data necessary to reconstructthe corresponding T pixels.

Therefore, since surplus bit(s) is used to perform coding when there isthe surplus bit(s), it is possible to reduce a degree of deteriorationof image quality of the image which is caused by coding. In addition,pieces of coded data each having a predetermined coding amount aregenerated. Therefore, if the generated pieces of coded data each havingthe predetermined coding amount are stored into a memory or the like, itis possible to easily specify a piece of coded data corresponding to apixel at a specific position in the image. As a result, randomaccessibility for the pieces of coded data can be kept.

Therefore, the present invention can reduce a degree of deterioration ofimage quality of the image while keeping random accessibility.

FURTHER INFORMATION ABOUT TECHNICAL BACKGROUND TO THIS APPLICATION

The disclosure of Japanese Patent Application No. 2008-245478 filed onSep. 25, 2008 including specification, drawings and claims isincorporated herein by reference in its entirety.

The disclosure of PCT application No. PCT/P2009/004642 filed on Sep. 16,2009, including specification, drawings and claims is incorporatedherein by reference in its entirety.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing structures of an image coding deviceand an image decoding device according to a first embodiment of thepresent invention.

FIG. 2 is a flowchart of image coding processing.

FIG. 3 is a flowchart of surplus bit counter updating processingperformed in the image coding processing.

FIG. 4 is a diagram showing an imaging device as an example.

FIG. 5 is a diagram showing an arrangement of neighboring pixels of ato-be-coded pixel, which are used in calculating a prediction value.

FIG. 6 is a diagram showing a data table as an example.

FIG. 7A is a diagram for explaining coding processing without using anysurplus bits.

FIG. 7B is a diagram for explaining coding processing without using anysurplus bits.

FIG. 8 is a diagram showing a data table as an example.

FIG. 9A is a diagram for explaining image coding processing usingsurplus bits in the first embodiment.

FIG. 9B is a diagram for explaining image coding processing usingsurplus bits in the first embodiment.

FIG. 10 is a flowchart of image decoding processing.

FIG. 11 is a flowchart of surplus bit counter updating processing R.

FIG. 12 is a block diagram showing a structure of a digital still cameraaccording to a second embodiment.

FIG. 13A is a diagram for explaining processing for IQ signals andluminance signals.

FIG. 13B is a diagram for explaining processing for IQ signals andluminance signals.

FIG. 14 is a block diagram showing structures of an image coding deviceand an image decoding device according to a third embodiment.

FIG. 15A is a diagram for explaining image coding processing in the casewhere the number of used surplus bits is not controlled.

FIG. 15B is a diagram for explaining image coding processing in the casewhere the number of used surplus bits is not controlled.

FIG. 16A is a diagram for explaining image coding processing in the casewhere the number of used surplus bits is controlled.

FIG. 16B is a diagram for explaining image coding processing in the casewhere the number of used surplus bits is controlled.

FIG. 17 is a flowchart of surplus bit control processing.

FIG. 18 is a flowchart of surplus bit counter updating processing A.

FIG. 19 is a block diagram showing a structure of a digital still cameraaccording to a fourth embodiment.

FIG. 20 is a diagram showing a personal computer and a printer accordingto a fifth embodiment.

FIG. 21 is a diagram for explaining a conventional technology.

FIG. 22 is a diagram for explaining a conventional technology.

DESCRIPTION OF THE PREFERRED EMBODIMENT(S)

The following describes embodiments of the present invention withreference to the drawings. It should be noted in the followingdescription of various embodiments and variations that the samereference numerals are assigned to the identical structural elementshaving the identical functions, so that the identical structuralelements are explained only once.

First Embodiment

FIG. 1 is a block diagram showing structures of an image coding device100 and an image decoding device 110 according to the first embodimentof the present invention.

(Coding Processing Performed by Image Coding Device)

First, description is given for processing performed by the image codingdevice 100 to code image (hereinafter, referred to as “image codingprocessing”) with reference to FIGS. 1, 2, and 3.

FIG. 2 is a flowchart of the image coding processing. FIG. 3 is aflowchart of surplus bit counter updating processing performed in theimage coding processing.

The image coding device 100 includes a pixel data receiving unit 101, aprediction value calculation unit 102, a difference calculation unit103, a quantization processing unit 108, and a packing unit 106.

The pixel data receiving unit 101 sequentially receives pieces of pixeldata from an imaging device 1312 that will be described later. The pixeldata receiving unit 101 includes a buffer not shown. The buffer is amemory on which at least one piece of pixel data can be recorded.

FIG. 4 is a diagram showing the imaging device 1312 as an example. Asshown in FIG. 4, in the imaging device 1312, a plurality of pixels arearranged in rows and columns. Here, it is assumed in the imaging device1312 that xa pieces of pixels are arranged in an X direction, and thatya pieces of pixels are arranged in an Y direction.

Each of the pixels has a color filter of one of red (R), green (G), andblue (B). The color filters in the imaging device 1312 are arrayed, forexample, in a Bayer pattern. In this example, one pixel among aplurality of pixels forming one picture is, for example, expressed by apixel P1, P2, P21, and P22.

For example, the pixel P1 has a color filter of green (G), and a pixelP2 has a color filter of red (R). Furthermore, the pixel P21 has a colorfilter of blue (B), and a pixel P22 has a color filter of green (G).

The pixel data receiving unit 101 sequentially receives pieces of pixeldata of pixels from a pixel (pixel P1) in the first row and the firstcolumn to a pixel in the first row and the xa-th column. In other words,the pixel data receiving unit 101 sequentially receives pieces of pixeldata of pixels from the first column to the xa-th column in the samerow. For example, the pixel data receiving unit 101 sequentiallyreceives pieces of data of pixels P1, P2, P3, . . . .

Here, after the pixel data receiving unit 101 receives a piece of pixeldata of a pixel in the xa-th column in the same row, the pixel datareceiving unit 101 receives a piece of pixel data of a pixel in thefirst column in a next row. By repeating the above-described processing,the pixel data receiving unit 101 finally receives a piece of data of apixel in the ya-th row and xa-th column.

Although details will be described later, the pieces of pixel data areassumed to be coded in units of fixed bit width. The fixed bit widthindicates a data amount (bits) obtained by coding pixel data. The fixedbit width is assumed to be s (where s is a natural number). Althoughdetails will be described later, the image coding device 100 outputs, inunits of the fixed bit width, pieces of data having the fixed bit width(s bits) which are generated by coding pieces of pixel data.

Hereinafter, a piece of pixel data of a color (for example, red, blue,green, or the like), which is processed first when pieces of pixel dataare coded in units of the fixed bit width (s bits), is refereed to as aninitial pixel value data. For example, a piece of data of the pixel P1shown in FIG. 4 is an initial pixel value data of green. Furthermore, apiece of data of the pixel P2 is an initial pixel value data of red.Still further, in the first embodiment, each piece of pixel datareceived by the pixel data receiving unit 101 is assumed to be a pieceof digital data (N=12) having a 12-bit length. In other words, eachpixel value of pixel data received by the pixel data receiving unit 101is assumed to be expressed by 12 bits.

The pixel data receiving unit 101 stores a received piece of pixel datainto an internal buffer. Here, if the pixel data receiving unit 101receives a new piece of pixel data while the internal buffer stores thepiece of pixel data, the pixel data receiving unit 101 provides thepiece of pixel data stored in the initial buffer to the prediction valuecalculation unit 102. Furthermore, the pixel data receiving unit 101provides the received new piece of pixel data to the differencecalculation unit 103. Moreover, the pixel data receiving unit 101overwrites the new pixel data onto the internal buffer to be storedtherein.

As shown in FIG. 1, the pixel data receiving unit 101 provides thereceived piece of pixel data to the prediction value calculation unit102 and the difference calculation unit 103 at an appropriate timing.Hereinafter, a piece of the n-th pixel data received by the pixel datareceiving unit 101 is referred to simply as the “n-th pixel data”.

More specifically, when the pixel data receiving unit 101 receives then-th pixel data (where n is a natural number of 2 or more), the pixeldata receiving unit 101 provides the (n-1)th pixel data to theprediction value calculation unit 102, and provides the n-th pixel datato the difference calculation unit 103.

If the received piece of pixel data is an initial pixel value data (YESat S114 in FIG. 2), then the pixel data receiving unit 101 provides thereceived piece of pixel data to the packing unit 106.

Hereinafter, a target pixel to be coded is referred to as a “to-be-codedpixel”. Furthermore, a pixel value of the to-be-coded pixel is referredto as a “to-be-coded pixel value”. Still further, a piece of pixel dataindicating the to-be-coded pixel value is referred to as a “to-be-codedpixel data”. The to-be-coded pixel data is assumed to be the n-th pixeldata that has been described earlier.

Each piece of pixel data received by the prediction value calculationunit 102 is one of the first pixel data, the second pixel data, and thethird pixel data which are described below.

The first pixel data is a piece of pixel data which is received by thepixel data receiving unit 101 prior to the to-be-coded pixel data. Thesecond pixel data is a piece of pixel data that indicates a valuecalculated by an operation using pieces of pixel data which are receivedby the pixel data receiving unit 101 prior to the to-be-coded pixeldata. The third pixel data is a piece of pixel data that is generated bydecoding, by the image decoding device 110, a piece of coded data thathas been generated by coding, by the image coding device 100, a piece ofpixel data prior to the to-be-coded pixel data.

The prediction value calculation unit 102, which will be described indetail later, calculates a prediction value of the to-be-coded pixeldata using a received piece of pixel data (S115 in FIG. 2).

Here, one of methods for coding pixel data is a prediction codingmethod. The prediction coding method is a coding method by which aprediction value, which will be described later, for the to-be-codedpixel is calculated, and then a difference value between a value of theto-be-coded pixel and the calculated prediction value is quantized.Hereinafter, the prediction value for the to-be-coded is pixel isreferred to simply as a “to-be-coded pixel prediction value”.

The to-be-coded pixel prediction value is a value that is generated bypredicting the to-be-coded pixel value using values of one or moreneighboring pixels of the to-be-coded pixel. The above employscharacteristics that a value of a neighboring pixel of the to-be-codedpixel has a high possibility of having the same value as the to-be-codedpixel value or having a value close to the to-be-coded pixel value. Inthe prediction coding method, by employing the to-be-coded pixelprediction value, it is possible to calculate the calculated differencevalue as small as possible and thereby suppress a quantization width.

FIG. 5 is a diagram showing an arrangement of neighboring pixels of theto-be-coded pixel, which are used in calculating the prediction value.“x” shown in FIG. 5 represents the to-be-coded pixel value. Furthermore,“a”, “b”, and “c” shown in FIG. 5 are pixel values of the neighboringpixels used to calculate the to-be-coded pixel prediction value “y”. Thefollowing presents prediction equations (1) to (7) which are generallyused to calculate a to-be-coded pixel prediction value.

y=a   (Equation 1)

y=b   (Equation 2)

y=c   (Equation 3)

y=a+b−c   (Equation 4)

y=a+(b−c)/2   (Equation 5)

y=b+(a−c)/2   (Equation 6)

y=(a+b)/2   (Equation 7)

As described above, the prediction value calculation unit 102 calculatesthe to-be-coded pixel prediction value “y” using pixels values “a”, “b”,and “c” of neighboring pixels of the to-be-coded pixel. A predictiondifference Δ (=y−x) between the prediction value “y” and the to-be-codedpixel “x” is calculated, and the prediction difference Δ is coded.

Using any one of the above-presented prediction equations (1) to (7) fora received piece of pixel data, the prediction value calculation unit102 calculates a to-be-coded pixel prediction value and provides thecalculated prediction value to the difference calculation unit 103.

It should be noted that the method of calculating a to-be-coded pixelprediction value a is not limited to the method using one of theprediction equations (1) to (7). For example, if it is possible tosecure enough capacity of the internal memory buffer in compressionprocessing, values of other neighboring pixels except pixels adjacent tothe to-be-coded pixel are also held in the memory buffer and used in theprediction. Thereby, it is possible to enhance an accuracy of theprediction.

The image coding device 100 further includes a quantization widthsetting unit 104, a fixed bit width setting unit 107, and a surplus bitcount unit 105. It should be noted that all or a part of units includedin the image coding device 100 may be implemented as hardware. It shouldalso be noted that all or a part of the units included in the imagecoding device 100 may be implemented as module(s) of a program executedby a Central Processing Unit (CPU) or the like.

The difference calculation unit 103 calculates a difference valuebetween (a) the to-be-coded pixel value provided from the pixel datareceiving unit 101 and (b) the prediction value provided from theprediction value calculation unit 102. Hereinafter, the difference valuecalculated by the difference calculation unit 103 is referred to as a“prediction difference value”. The prediction difference value is avalue calculated by subtracting the prediction value from theto-be-coded pixel value. The difference calculation unit 103 providesthe calculated prediction difference value to the quantization widthsetting unit 104 (S116 in FIG. 2).

The fixed bit width setting unit 107 sets the previously-described fixedbit width according to instructions from the outside. Hereinafter,information indicating the fixed bit width is referred to as “fixed bitwidth information”. Then, the fixed bit width setting unit 107 providesthe fixed bit width information to the packing unit 106, thequantization width setting unit 104, and the surplus bit count unit 105.

It should be noted that the fixed bit width setting unit 107 may set thefixed bit width without any instructions from the outside.

In the first embodiment, as described previously, the fixed bit with isassumed to be s bits. The fixed bit width is, for example, set to a buswidth of data transfer of a used integrated circuit (S111 in FIG. 2).

The quantization width setting unit 104 sets a quantization width Q ofthe prediction difference value, based on the prediction differencevalue that is provided from the difference calculation unit 103regarding each to-be-coded pixel. The quantization width setting unit104 outputs the prediction difference value and the set quantizationwidth Q to the quantization processing unit 108.

Hereinafter, an absolute value of the prediction difference value isreferred to as a “prediction difference absolute value”. Furthermore,hereinafter, the number of digits of binary data expressing theprediction difference absolute value by binary number is referred to asa “prediction difference binary digit number” (in units of bits). Stillfurther, hereinafter, the number of digits of binary data expressing theprediction difference value by binary number is referred to as a“code-added prediction difference binary digit number” (in units ofbits).

The quantization width Q is a value calculated by subtracting areference bit width M from a code-added prediction difference binarydigit number. If the calculated value is a negative value, a value ofthe quantization width Q is “0”. Here, the reference bit width M is abit amount used to express one pixel.

The reference bit width M is calculated according to the followingequation (8) based on the fixed bit width (s bits) provided from thefixed bit width setting unit 107. Here, if the calculated value of thereference bit width M has a value after the decimal point, the referencebit width truncates the value after the decimal point.

M=(s−N×q)/(Pix−q)−Code   (Equation 8)

In the equation (8), s represents the fixed bit width. N represents adata amount (in units of bits) of pixel data provided to the pixel datareceiving unit 101. q represents the number of pieces of pixel data aspieces of initial pixel value data, which are received by the packingunit 106 in performing coding for each fixed bit width (s bits). Pixrepresents the number of pixels to be included in coded data for eachfixed bit width (s bits). A value of Pix is a predetermined value.

In the equation (8), Code represents quantization width information thatindicates a quantization width Q in quantizing a to-be-coded pixel.Hereinafter, Code is referred to as “quantization width informationCode”. The quantization width information Code is expressed by one ormore bits. For example, if the quantization width information Code isexpressed by three bits, a value of Code calculated according to theequation (8) is “3”.

The quantization width information Code is packed with the quantizedpixel data by the packing unit 106, and the packed data is outputted(S136 in FIG. 2).

Here, it is also possible that a quantization width Q is calculated froma maximum value of the prediction difference absolute value(hereinafter, referred to as a “maximum pixel value difference”) foreach of pixels to be coded, and that the pixels to be coded arequantized by the same quantization width Q. Thereby, it is possible todecrease the number of bits allocated to the quantization widthinformation Code.

However, if the number of pixels to be coded which correspond to thesame Code is increased, there are disadvantages that an accuracy ofquantization determination in units of pixel is deteriorated due to theuse of the above-mentioned maximum pixel value difference, as disclosedin Patent Reference 1.

The surplus bit count unit 105 includes a surplus bit counter indicatingthe number of surplus bit. The surplus bit(s) is a bit(s) that is notused and then left when a quantized value of a prediction differencevalue or a prediction difference value is expressed in units of thereference bit width M.

The surplus bit counter indicates “0” in an initial state. If acode-added prediction difference binary digit number corresponding to ato-be-coded pixel is smaller than M bits (where M is a natural number),the surplus bit count unit 105 increments a value indicated by thesurplus bit counter by a difference value between M and the code-addedprediction difference binary number.

On the other hand, if the code-added prediction difference binary numberis greater than M and the value indicated by the surplus bit counter isa positive value, the surplus bit count unit 105 provides informationindicating the number of surplus bits to the quantization width settingunit 104, and decrements the value indicated by the surplus bit counter(S124N in FIG. 3).

Next, there is presented a data table DT100 indicating various pieces ofdata in the case of coding 12-bit pixel data when the reference bitwidth M is 8 bits.

FIG. 6 is a diagram showing the data table DT100 as an example. The“prediction difference absolute value” indicated in the data table DT100is an absolute value of the prediction difference value which has beendescribed earlier. The “prediction difference binary digit number”, the“code-added prediction difference binary digit number”, and the“quantization width Q” have already been explained earlier, and will notbe therefore explained again.

A value of the quantization width Q indicated in the data table DT100 isa value calculated by subtracting the reference bit width M from thecode-added prediction difference binary number, when the reference bitwidth M is 8 bits. Here, if the calculated value is a negative value, avalue of the quantization width Q is “0”.

The “surplus bit number” indicates the number of surplus bits. Thesurplus bit number is a value calculated by subtracting the code-addedprediction difference binary number from the reference bit width M.

Here, it is assumed that the fixed bit width set by the fixed bit widthsetting unit 107 is 256 bits. It is also assumed that a data amount ofpixel data provided to the pixel data receiving unit 101 is 12 bits. Itis further assumed that the number of pieces of pixel data as pieces ofinitial pixel value data, which are received by the packing unit 106 inperforming coding in units of the fixed bit width (s bits) is “2”. It isstill further assumed that the number of pixels to be included in codeddata for each fixed bit width (s bits) is “26”. It is still furtherassumed that the quantization width information Code is expressed by 1bit.

In other words, it is assumed in the equation (8) that a value of s is“256”, a value of N is “12”, a value of q is “2”, a value of Pix is“26”, and a value of Code is “1”. Under the assumption, according to theabove-presented equation (8), M=(256−12×2)/(26−2)−1=26/3=8.7.

Therefore, the value of 8.7 truncates the value after the decimal point,in order to set the coded data amount to be equal to or smaller than 256bits. Thereby, the reference bit width M is 8. In other words,basically, 12-bit pixel data is compressed to 8-bit pixel data. In thiscase, since 256/12=21.3, before the data compression, 256-bit data canindicate 21 pieces of 12-bit pixel data. On the other hand, after thedata compression, 256-bit data can indicate 26 pieces of pixel data.

As shown in FIG. 6, if the code-added prediction difference binarynumber is smaller than the reference bit width M of “8” (YES at S121 inFIG. 3), the surplus bit count unit 105 increments a value of thesurplus bit counter by a value that is calculated by subtracting thecode-added prediction difference binary number from 8 (S122 in FIG. 3).As described above, the surplus bit counter indicates the number ofsurplus bits. Here, if the code-added prediction difference binarynumber is equal to or greater than the reference bit width M of “8”, thevalue of the surplus bit counter is not incremented.

The quantization processing unit 108 performs quantization processingfor quantizing a prediction difference value corresponding to ato-be-coded pixel, using the quantization width Q set by thequantization width setting unit 104. Then, the quantization processingunit 108 provides the packing unit 106 with data (hereinafter, referredto as “coded pixel data”) that is generated by expressing, by binarynumber, a value obtained in the quantization processing. Thequantization processing using the quantization width Q is processing ofdividing the prediction difference value corresponding to theto-be-coded pixel by the Q-th power of 2. Here, if the quantizationwidth Q is “0”, the quantization processing unit 108 does not performquantization processing. In this case, the pixel data (hereinafter,referred to as “coded pixel data”) that is generated by expressing theprediction difference value by a designated bit number is provided tothe packing unit 106.

The packing unit 106 combines (a) at least one initial pixel value data,(b) plural pieces of coded pixel data, and (c) quantization widthinformation Code corresponding to at least one pixel, in order to packthem into s-bit data (S136 in FIG. 2).

Hereinafter, the data generated in the packing is referred to as“packing data”. The packing unit 106 performs processing of storing thes-bit packing data into a memory such as a SDRAM, or performs processingof providing the s-bit packing data to the unpacking unit 116. Here, ifthere is/are any not-used bit(s) in the s-bit packing data, the packingunit 106 replaces the not-used bit(s) by dummy data.

Each of FIGS. 7A and 7B is a diagram for explaining coding processingwithout using any surplus bits.

Here, it is assumed that the pixel data receiving unit 101 sequentiallyreceives the same number of pieces of pixel data as the number (26) ofpixels to be included in data of the fixed bit width (s bits). It isalso assumed that a data amount of a piece of pixel data provided to thepixel data receiving unit 101 is 12 bits. In other words, a dynamicrange of a piece of pixel data is 12 bits. It is assumed that thereference bit width M is 8 bits. It is further assumed that thequantization width information Code is expressed by 3 bits.

FIG. 7A shows, as an example, 11 pieces of pixel data among 26 pieces ofpixel data which are provided into the pixel data receiving unit 101.

It is assumed that the pixel data receiving unit 101 receives pieces of12-bit pixel data corresponding to respective pixels in an order of thepixel P1, P2, . . . , P11. A numeral value indicated in each of thepixels P1 to P11 is a pixel value indicated in each piece of pixel data.It is also assumed that the pixel data corresponding to the pixel P1 isan initial pixel value data of green, and that the pixel datacorresponding to the pixel P2 is an initial pixel value data of red.

In the first embodiment, the to-be-coded pixel prediction value is, forexample, calculated according to the prediction equation (1). In thiscase, the calculated to-be-coded pixel prediction value is a value of apixel on the immediately left of the to-be-coded pixel. It is thereforepredicted that the pixel value of the to-be-coded pixel has a highpossibility of being the same value (level) as that of a pixel receivedimmediately prior to the to-be-coded pixel.

The prediction difference value is a value generated by subtracting apixel value of the (n-1)th pixel from a pixel value of the n-th pixel.

The prediction difference absolute value indicates an absolute value ofa difference value of values of two adjacent pixels. In other words, theprediction difference absolute value is an absolute value of theprediction difference value. For example, if a pixel value of the pixelP1 is “300” and a pixel value of the pixel P2 is “200”, a predictiondifference absolute value calculated from the pixel values of the pixelsP1 and P2 is “80”.

If the prediction difference absolute value is “80”, the predictiondifference absolute value of “80” is not quantized because “80” can beexpressed by the reference bit width M (8 bits). In other words, aquantization width Q of the prediction difference absolute value of “80”is “0” (see FIG. 6).

In FIG. 7A, when to-be-coded pixel values are to be coded in units ofthe fixed bit width (s bits), a plurality of pixels except pixelscorresponding to the pieces of initial pixel value data among theto-be-coded pixel values are classified into groups in units of adjacentthree pixels.

In the example of FIG. 7A, a maximum value (hereinafter, referred to asa “maximum prediction difference absolute value”) of three predictiondifference absolute values corresponding to respective three pixelsbelonging to each group is set to a value to be used in calculating aquantization width Q to be used in quantizing the prediction differencevalues. Furthermore, in the example of FIG. 7A, pixel values belongingto the same group are quantized by the same quantization width Q.

For example, three prediction difference absolute values correspondingto respective pixels P3, P4, and P5 which belong to a group G1 are “40”,“20”, and “40”, respectively. In this case, a maximum predictiondifference absolute value is “40”. In this case, since the maximumprediction difference absolute value of “40” is included in a range from“32” to “63” shown in FIG. 6, a quantization width Q for quantizing thepixels P3, P4, and P5 belonging to the group G1 is “0”.

Moreover, three prediction difference absolute values corresponding torespective pixels P6, P7, and P8 which belong to a group G2 are “270”,“500”, and “66”, respectively. In this case, a maximum predictiondifference absolute value is “500”. In this case, since the maximumprediction difference absolute value of “500” is included in a rangefrom “256” to “511” shown in FIG. 6, a quantization width Q forquantizing the pixels P6, P7, and P8 belonging to the group G2 is “2”.Therefore, all prediction difference values corresponding to the pixelsP6, P7, and P8 belonging to the group G2 are quantized by thequantization width Q of “2”.

The “used bit number” indicated in FIG. 7A is the number of bits ofpixel data used to express a value that is generated by quantizing acorresponding prediction difference value.

For example, since the quantization width Q corresponding to the pixelP3 is “0”, the prediction difference value of “40” corresponding to thepixel P3 is quantized by the quantization width Q of “0”. In otherwords, the prediction difference value of “40” is divided by the 0-thpower of 2 (=1). A value obtained by the division is “40”. In otherwords, the prediction difference value of “40” is not quantized. In theexample of the processing, 8-bit data is used to express the value “40”obtained by the division.

Furthermore, for example, since the quantization width Q correspondingto the pixel P7 is “2”, the prediction difference value of “−500”corresponding to the pixel P7 is quantized by the quantization width Qof “2”. In other words, the prediction difference value of “−500” isdivided by the second power of 2 (=4). A value obtained by the divisionis “−125”. In the example of the processing, 8-bit data is used toexpress the value “−125” obtained by the division.

FIG. 7B is a diagram showing data of a fixed bit width (s bits) which isprovided from the image coding device 100 when the processing andoperation explained in FIG. 7A are performed. In FIG. 7B, a numeralvalue indicated in each of the pixels P1 and P2 indicates the number ofbits of pixel data of the corresponding pixel. As shown in FIG. 7B, apixel value of each of the pixels P1 and P2 corresponding to a piece ofinitial pixel value data is expressed by 12-bit pixel data. Here, 3-bitquantization width information Code is added by the packing unit 106 tothe beginning of a set of three pieces of pixel data included in eachgroup.

As shown in FIG. 7B, a pixel value of each of three pixels included ineach group is expressed by 8-bit pixel data.

It is assumed in the first embodiment that, when the reference bit widthM is 8 bits and 12-bit pixel data is to be coded and 12-bit coded datais to be decoded, a data table DT110 described below is used. It is alsoassumed in the first embodiment that the quantization width informationCode is expressed by 3 bits.

FIG. 8 is a diagram showing the data table DT110 as an example. As shownin FIG. 8, the data table DT110 differs from the data table DT100 inFIG. 6 in that an item “Code” is added. Except the item “Code”, the datatable DT110 is the same as the data table DT100, and therefore thedetailed description of the data table DT110 is not repeated below.

In the item “Code”, decimal numbers from “0” to “7” are expressed bypieces of 3-bit quantization width information Code. Thereby, the piecesof 3-bit quantization width information Code can indicate quantizationwidths Q corresponding to respective prediction difference absolutevalues that are classified into 8 kinds. More specifically, as shown inthe data table DT110, the 8 kinds of codes (“000”, “001”, and the like)which are indicated by the respective pieces of 3-bit quantization widthinformation Code are associated with respective quantization widths Qcorresponding to respective prediction difference absolute values thatare classified into 8 kinds.

For example, in the data table DT110, a code “000” indicated by a pieceof quantization width information Code is associated with predictiondifference absolute values from “0” to “31”. Thereby, the code “000”indicated by the quantization width information Code indicates aquantization width Q of “0”.

Moreover, for example, in the data table DT110, a code “100” indicatedby a piece of the quantization width information Code is associated withprediction difference absolute values from “256” to “511”. Thereby, thecode “100” indicated by quantization width information Code indicates aquantization width Q of “2”.

Here, the data table DT110 is previously stored in a storage device suchas a memory (not shown) which is included in each of the image codingdevice 100 and the image decoding device 110. In other words, both theimage coding device 100 and the image decoding device 110 use the samedata table to perform various kinds of processing.

(Image Coding Processing)

Next, the image coding processing according to the first embodiment isdescribed in detail.

FIG. 9A and FIG. 9B are diagrams for explaining image coding processingusing surplus bits in the first embodiment.

Here, it is assumed that the pixel data receiving unit 101 sequentiallyreceives the same number of pieces of pixel data as the number of pixels(26) included in data of the fixed bit width (s bits). It is alsoassumed that a data amount of a piece of pixel data provided to thepixel data receiving unit 101 is 12 bits. In other words, a dynamicrange of a piece of pixel data is 12 bits. It is assumed that thereference bit width M is 8 bits. It is further assumed that thequantization width information Code is expressed by 3 bits.

FIG. 9A shows, as an example, 11 pieces of pixel data among 26 pieces ofpixel data which are provided into the pixel data receiving unit 101.

It is assumed that the pixel data receiving unit 101 receives pieces of12-bit pixel data corresponding to respective pixels in an order of thepixel P1, P2, . . . , P11. A numeral value indicated in each of thepixels P1 to P11 is a pixel value indicated in each piece of pixel data.It is also assumed that the pixel data corresponding to the pixel P1 isan initial pixel value data of green, and that the pixel datacorresponding to the pixel P2 is an initial pixel value data of red.

In the first embodiment, the to-be-coded pixel prediction value is, forexample, calculated according to the prediction equation (1). In thiscase, the calculated to-be-coded pixel prediction value is a value of apixel on the immediately left of the to-be-coded pixel. It is thereforepredicted that the pixel value of the to-be-coded pixel has a highpossibility of being the same value (level) as that of a pixel receivedimmediately prior to the to-be-coded pixel.

The “prediction difference value”, “prediction difference absolutevalue”, “quantization width Q”, and “used bit number” indicated in FIG.9A have already been described with reference to FIG. 7A, and thereforethe description is not repeated again below.

The “surplus bit number” is the number of bit(s) (surplus bit(s)) thatare not used and then left when a quantized value of a correspondingprediction difference value or prediction difference value is expressedin units of the reference bit width M.

The “accumulated surplus bit number” is a value indicated by a surplusbit counter when coding is performed according to a corresponding usedbit number.

In FIG. 9A, when to-be-coded pixel values are to be coded in units ofthe fixed bit width (s bits), a plurality of pixels except pixelscorresponding to the pieces of initial pixel value data among theto-be-coded pixel values are classified into groups in units of adjacentthree pixels. The groups have already been described with reference toFIG. 7A, and therefore the description is not repeated again below.

Here, it is assumed that a memory (not shown) in which data is stored isprovided in the quantization width setting unit 104 in the image codingdevice 100 in FIG. 1. It is assumed that the data table DT110 in FIG. 8is previously stored in the quantization width setting unit 104. Itshould be noted that the memory in which the data table DT110 is storedmay be provided outside the quantization width setting unit 104.

It is also assumed that a memory (not shown) in which data is stored isprovided in the packing unit 106 in the image coding device 100. It isfurther assumed that a memory (not shown) in which data is stored isprovided in the prediction value calculation unit 102.

In the image coding processing in FIG. 2, Step S111 is first performed.

At Step S111, the fixed bit width setting unit 107 sets a fixed bitwidth (s bits). The fixed bit width is, for example, set to a bus widthof data transfer of a used integrated circuit. Then, the fixed bit widthsetting unit 107 provides the fixed bit width information indicating thefixed bit width (s bits) to the packing unit 106, the quantization widthsetting unit 104, and the surplus bit count unit 105.

At Step S112, the quantization width setting unit 104 calculates thereference bit width M according to the equation (8), as describedearlier. Here, it is assumed that the calculated reference bit width Mis “8”. The quantization width setting unit 104 provides the calculatedreference bit width M to the surplus bit count unit 105.

At Step S113, the pixel data receiving unit 101 receives a piece ofpixel data.

At Step S114, the pixel data receiving unit 101 determines whether ornot the received piece of pixel data is a piece of initial image valuedata. If the determination is YES at Step S114, then the pixel datareceiving unit 101 stores the received piece of pixel data into aninternal buffer, and provides the received piece of pixel data to thepacking unit 106. Then, the processing proceeds to Step S135 that willbe described later. On the other hand, if the determination is NO atStep S114, then the step described later is performed and then theprocessing proceeds to Step S115.

Here, it is assumed that the pixel data receiving unit 101 receives, asa piece of initial pixel value data, a piece of pixel data correspondingto the pixel P1. Under the assumption, the pixel data receiving unit 101stores the received piece of pixel data into the internal buffer, andprovides the received piece of pixel data to the packing unit 106. Here,if a piece of pixel data has already been stored in the buffer, thepixel data receiving unit 101 overwrites the received piece of pixeldata on the stored data, thereby storing the received one into theinternal buffer.

When the piece of pixel data is received as the piece of initial pixelvalue data, the packing unit 106 stores the received piece of pixel data(initial pixel value data) into an internal memory. Then, the processingproceeds to Step S135.

At Step S135, the packing unit 106 determines whether or not the numberof received piece(s) of pixel data is equal to the predetermined valuePix. Each received piece of pixel data is an piece of initial pixelvalue data or a piece of to-be-coded pixel data. Pix represents thenumber of pixels to be included in s-bit coded data (packing data), asdescribed previously. A value of Pix is, for example, “26”.

If the determination is YES at Step S135, then it is determined that thenumber of received piece(s) of image data is “0”. Here, after that, forexample, if the packing unit 106 receives one piece of pixel data, thenumber of received pieces of pixel data is “1”. Then, the processingproceeds to Step S136.

On the other hand, if the determination is NO at Step S135, then StepS113 is performed again. Here, it is assumed that the number of thereceived piece(s) of pixel data is not equal to the predetermined valuePix. Therefore, Step S113 is performed again.

Next, it is assumed that the pixel data receiving unit 101 receives, asa piece of initial pixel value data, a piece of pixel data correspondingto the pixel P2 (S113).

Under the assumption, the determination at Step S114 is YES, andtherefore the pixel data receiving unit 101 overwrites the receivedpiece of pixel data onto the internal buffer to be stored and providesthe received piece of pixel data to the packing unit 106.

Then, Step S135 described previously is performed, and Step S113 isperformed again.

Here, the pixel P3 is assumed to be a to-be-coded pixel. Under theassumption, the pixel data receiving unit 101 receives a piece of pixeldata (to-be-coded pixel data) corresponding to the pixel P3. A pixelvalue of the to-be-coded pixel data is assumed to be “260”. Under theassumption, since the received piece of pixel data is not a piece ofinitial pixel value data (NO at S114), the pixel data receiving unit 101provides the received piece of pixel data to the difference calculationunit 103.

Hereinafter, a group to which a to-be-coded pixel not corresponding to apiece of initial pixel value data belongs is referred to a “group to beprocessed”. For example, when a to-be-coded pixel is the pixel P3, thegroup G1 to which the pixel P3 belongs is a group to be processed.

On the other hand, if the determination at Step S114 is NO, then thepixel data receiving unit 101 provides a piece of pixel data stored inthe internal buffer to the prediction value calculation unit 102. Here,the provided piece of pixel data is assumed to have a pixel value of“220” of the pixel P2. Each time the prediction value calculation unit102 receives a piece of pixel data, the prediction value calculationunit 102 stores the received piece of pixel data into the internalmemory.

Moreover, the pixel data receiving unit 101 overwrites the receivedpiece of pixel data onto the internal buffer to be stored therein.Furthermore, the pixel data receiving unit 101 provides the receivedpiece of pixel data (to-be-coded pixel data) to the differencecalculation unit 103. Then, the processing proceeds to Step S115.

At Step S115, the prediction value calculation unit 102 calculates theprediction value of the to-be-coded pixel. More specifically, theprediction value calculation unit 102 calculates a prediction value byusing the prediction equation (1). In this case, the pixel value (“220”)indicted by the received piece of pixel data is calculated as theprediction value. The prediction value calculation unit 102 provides thecalculated prediction value of “220” to the difference calculation unit103.

Furthermore, when a prediction value of the h-th to-be-coded pixel is tobe calculated, the prediction value is set to a value indicated by the(h-1)th pixel data if the (h-1)th pixel data is a piece of initial pixelvalue data, while the prediction value of the to-be-coded pixel is setto a pixel value indicated by a piece of pixel data that is generated byproviding data coded by the image coding device 100 to the imagedecoding device 110 and decoding the coded data by the image decodingdevice 110 if the (h-1)th pixel data is not a piece of initial pixelvalue data. Thereby, even in the situation where quantization processingperformed by the quantization processing unit 108 causes errors, theimage coding device 100 and the image decoding device 110 can generatethe same prediction value.

At Step S116 calculates a prediction difference value. Morespecifically, the difference calculation unit 103 subtracts the receivedprediction value of “220” from the pixel value (“260”) indicated by thereceived to-be-coded pixel data, in order to obtain the predictiondifference value of “40”. The difference calculation unit 103 providesthe calculated prediction difference value of “40” to the quantizationwidth setting unit 104.

Hereinafter, prediction difference values corresponding to respectivethree pixels belonging to a group to be processed are referred to as“to-be-processed prediction difference values”. For example, if a groupto be processed is the group G1, prediction difference values of therespective pixels P3, P4, and P5 belonging to the group G1 areto-be-processed prediction difference values.

The quantization width setting unit 104 has a difference value counter.The difference value counter is a counter indicating the number ofreceived prediction difference values. An initial value of thedifference value counter is “0”. Each time of receiving a predictiondifference value, the quantization width setting unit 104 stores thereceived prediction difference value into an internal memory, andincrements a value indicated by the difference value counter by “1”.

At Step S117, the quantization width setting unit 104 determines whetheror not three prediction difference values are received. In other words,the quantization width setting unit 104 determines whether or not thevalue indicated by the difference value counter is “3”. If thedetermination at Step S117 is YES, then the quantization width settingunit 104 sets the value of the difference value counter to “0”, and theprocessing proceeds to Step S118. On the other hand, if thedetermination at Step S117 is NO, then Step S113 is performed again.Here, it is assumed that the value indicated by the difference valuecounter is “1”. Therefore, Step S113 is performed again.

Then, the set of Steps S113 to S116 as described previously is repeatedtwice, so that the quantization width setting unit 104 receives threeprediction difference values. The three prediction difference valuesreceived by the quantization width setting unit 104 are three predictiondifference values corresponding to the respective three pixels in agroup. In this case, the internal memory holds the three predictiondifference values. If the quantization width setting unit 104 receivesthree prediction difference values (YES at S117), then the quantizationwidth setting unit 104 sets the value of the difference value counter to“0”.

At Step S118, quantization width setting processing is performed. In thequantization width setting processing, the quantization width settingunit 104 calculates the number of digits (code-added predictiondifference binary digit number) of binary data expressing, by code-addedbinary number, each of the three prediction difference values stored inthe internal memory. Here, it is assumed that the three predictiondifference values are three prediction difference values “40”, “20”, and“40”, respectively, which correspond to the respective pixels P3, P4,and P5 belonging to the group G1 in FIG. 9A. Under the assumption, thecalculated three code-added prediction difference binary numbers are“7”, “7”, and “7”, respectively.

Furthermore, the quantization width setting unit 104 calculatesrespective absolute values (prediction difference absolute values) ofthe three prediction difference values. Here, the three predictiondifference values are assumed to be “40”, “20”, and “40”, respectively.Under the assumption, the calculated three prediction differenceabsolute values are “40”, “20”, and “40”, respectively.

Then, the quantization width setting unit 104 calculates a maximum valueof the three prediction difference absolute values (hereinafter,referred to as a “maximum prediction difference absolute value”). Inthis case, the maximum prediction difference absolute value is “40”.

Then, the quantization width setting unit 104 sets a quantization widthQ by using the data table DT110 in FIG. 8 that is stored in the internalmemory and the maximum prediction difference absolute value (forexample, “40”).

If the maximum prediction difference absolute value is “40”, it isincluded in a value range from “32” to “63” indicated in the data tableDT110. Therefore, the quantization width Q is set to “0”. The setquantization width Q is set to correspond to each of the three pixelsbelonging to the group to be processed. In this case, all of the threequantization widths Q corresponding to the respective three pixels (forexample, the pixels P3, P4, and P5) belonging to the group to beprocessed (for example, the group G1) are set to “0”.

Furthermore, the quantization width setting unit 104 provides thequantization width information Code to the packing unit 106. In thiscase, since the maximum prediction difference absolute value of “40” isincluded in a value range from “32” to “63” indicated in the data tableDT110, the quantization width information Code is information indicatingthe code “001”.

Furthermore, in receiving the quantization width information Code, thepacking unit 106 stores the received quantization width information Codeto an internal memory.

At Step S119, the quantization width setting unit 104 provides thesurplus bit count unit 105 with a maximum code-added predictiondifference binary number among three code-added prediction differencebinary numbers corresponding to the respective three pixels belonging tothe group to be processed (for example, the group G1).

At Step S120, surplus bit counter updating processing is performed.

As shown in FIG. 3, in the surplus bit counter updating processing, StepS121 is first performed.

At Step S121, the surplus bit count unit 105 determines whether or notthe received code-added prediction difference binary number is smallerthan the reference bit width M. If the determination at Step S121 isYES, then the processing proceeds to Step S122. On the other hand, ifthe determination at Step S121 is NO, then the processing proceeds toStep S123 as described later. Here, it is assumed that the receivedcode-added prediction difference binary number is “7” and the referencebit width M is 8 bits. Under the assumption, the determination is YES,and therefore Step S122 is performed.

At Step S122, counter value increment processing is performed. In thecounter value increment processing, the surplus bit count unit 105increments a value indicated by the surplus bit counter by a value (forexample, “1”) that is generated by subtracting the received code-addedprediction difference binary number (for example, “7”) from thereference bit width M (for example, “8”). By the above processing, thesurplus bit counter is assumed to indicate “1”.

Then, the surplus bit counter updating processing is completed, and theprocessing returns to the image coding processing in FIG. 2 again andproceeds to Step S130.

At Step S130, data transmission processing is performed. In the datatransmission processing, the quantization width setting unit 104provides the quantization processing unit 108 with a quantization widthQ and a prediction difference value which correspond to the p-th pixelbelonging to the group to be processed (for example, the group G1).Here, an initial value of p is “1”. For example, if the group to beprocessed is the group G1, the pixels P3, P4, and P5 belonging to thegroup G1 are the first, second, and third pixels, respectively.

At Step S131, the quantization width setting unit 104 determines whetheror not the quantization width Q corresponding to the p-th pixelbelonging to the group to be processed is “0”. If the determination atStep S131 is YES, then the processing proceeds to Step S133. On theother hand, if the determination at Step S131 is NO, then the processingproceeds to Step S132 as described later.

Here, it is assumed that the quantization width Q corresponding to thep-th pixel belonging to the group to be processed is “0” and that theprocessing proceeds to Step S133.

At Step S133, coding processing is performed. In the coding processing,the quantization processing unit 108 performs the following processingNA, when the quantization width Q provided from the quantization widthsetting unit 104 is “0” and the quantization processing unit 108 doesnot receive any counter decrement value information described layer.

In the processing NA, the quantization processing unit 108 generatesdata (hereinafter, referred to as “coded pixel data”) that expresses theprediction difference value provided from the quantization width settingunit 104 by bits of the code-added prediction difference binary digitnumber corresponding to the prediction difference value. Then, thequantization processing unit 108 provides the generated coded pixel datato the packing unit 106.

Here, the received quantization width Q is assumed to be “0”. Inaddition, the received prediction difference value is assumed to be“40”. Moreover, the code-added prediction difference binary digit numbercorresponding to the prediction difference value of “40” is assumed tobe “7”.

Under the assumption, the quantization processing unit 108 generates apiece of coded pixel data that expresses the prediction difference valueof “40” by “7” bits. More specifically, the number of bits used togenerate the piece of coded pixel data is “7” as indicated in FIG. 9A.In this case, if the reference bit width M is 8 bits, one surplus bitoccurs.

Then, the generated piece of coded pixel data is provided to the packingunit 106. Here, the packing unit 106 stores the received piece of codedpixel data to the internal memory.

Moreover, in the coding processing, the quantization processing unit 108performs processing NB described below, when the quantization width Qprovided from the quantization width setting unit 104 is “0” and thequantization processing unit 108 receives counter decrement valueinformation described layer.

Moreover, in the coding processing, the quantization processing unit 108performs processing NC described below, when the quantization width Qprovided from the quantization width setting unit 104 is equal to ormore than “1” and the quantization processing unit 108 receives counterdecrement value information described layer.

At Step S134, it is determined whether or not the quantization widthsetting unit 104 provides the surplus bit count unit 105 with all(three) of the calculated code-added prediction difference binarynumbers corresponding to the group to be processed. If the determinationat Step S134 is YES, then the quantization width setting unit 104 sets avalue of p to “1” and the processing proceeds to Step S135. On the otherhand, if the determination at Step S134 is NO, then the quantizationwidth setting unit 104 increments the value of p by “1”. Then, Step S119is performed again.

Here, the determination is assumed to be NO, and therefore Step S119described previously is performed again. It is assumed that, by theprocessing, a code-added prediction difference binary number of “7”corresponding to the pixel P4 is provided to the surplus bit count unit105.

Then, again, Steps S121 and S122 in FIG. 3 are performed, and therebythe value indicated by the surplus bit counter is assumed to be “2”.

Then, the surplus bit counter updating processing is completed, and StepS130 in FIG. 2 is performed again. It is assumed that, by theprocessing, the quantization width Q which corresponds to a p-th pixelbelonging to the group to be processed and the prediction differencevalue which corresponds to the second pixel belonging to the group to beprocessed are provided to the quantization processing unit 108.

Then, Steps S131 and S133 described previously are performed. By theprocessing, the coded pixel data expressed by “7” bits is provided tothe packing unit 106. Here, the packing unit 106 stores the receivedcoded pixel data to the internal memory.

Then, the determination at Step S134 is NO, and therefore thequantization width setting unit 104 increments the value of p by “1”.Then, Step S119 is performed again. It is assumed that, by theprocessing, a code-added prediction difference binary number of “7”corresponding to the pixel P5 is provided to the surplus bit count unit105.

Then, again, Steps S121 and S122 in FIG. 3 are performed, and therebythe value indicated by the surplus bit counter is assumed to be “3”.

Then, the surplus bit counter updating processing is completed, and StepS130 in FIG. 2 is performed again. It is assumed that, by theprocessing, the quantization width Q and the prediction difference valuewhich correspond to the third pixel belonging to the group to beprocessed are provided to the quantization processing unit 108.

Then, Steps S131 and S133 described previously are performed. By theprocessing, the coded pixel data expressed by “7” bits is provided tothe packing unit 106. Here, the packing unit 106 stores the receivedcoded pixel data to the internal memory.

Then, the determination at Step S134 is YES, and therefore thequantization width setting unit 104 sets the value of p to “1” and StepS135 is performed.

At Step S135, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe number of the received piece(s) of pixel data is not equal to thepredetermined value Pix. Therefore, Step S113 is performed again.

Here, it is assumed that, at this time, as shown in FIG. 9B, the packingunit 106 have received (a) pieces of initial pixel value data (each 12bits) corresponding to the respective pixels P1 and P2, (b) quantizationwidth information Code (3 bits), and (c) pieces of coded pixel data(each 7 bits) corresponding to the respective pixels P3, P4, and P5. Inthis case, the internal memory in the packing unit 106 holds consecutivepieces of data as shown in FIG. 9B from the piece of initial pixel valuedata corresponding to the pixel P1 to the piece of the coded pixel datacorresponding to the pixel P5 which are shown in FIG. 9B.

Next, it is assumed that the pixel data receiving unit 101 receives apiece of pixel data corresponding to the pixel P6 having a pixel valueof “590” which is shown in FIG. 9A.

Under the assumption, the determination at Step S114 is NO, andtherefore Step S115 and S116 are performed as described previously.

By the processing at Step S115 and S116 described previously, aprediction difference value of “270” is calculated. Furthermore, thedifference calculation unit 103 provides the calculated predictiondifference value of “270” to the quantization width setting unit 104.

At Step S117, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe value indicated by the difference value counter is “1”. Therefore,Step S113 is performed again.

Then, the set of Steps S113 to S116 as described previously is repeatedtwice, so that the quantization width setting unit 104 receives threeprediction difference values of “270”, “−500”, and “−66” shown in FIG.9A. If the quantization width setting unit 104 receives the threeprediction difference values (YES at S117), then the quantization widthsetting unit 104 sets the value of the difference value counter to “0”.

At Step S118, the same quantization width setting processing asdescribed previously is performed, so that the details are not explainedagain. Here, it is assumed that the three prediction difference valuesare three prediction difference values “270”, “−500”, and “−66”,respectively, which correspond to the respective pixels P6, P7, and P8belonging to the group G2 in FIG. 9A. Under the assumption, thecalculated three code-added prediction difference binary numbers are“10”, “10”, and “8”, respectively. In this case, the calculated threecode-added prediction difference binary numbers “10”, “10”, and “8”correspond to the pixels P6, P7, and P8, respectively.

Furthermore, the quantization width setting unit 104 calculates threeprediction difference absolute values “270”, “500”, and “66”, asdescribed previously. In this case, a maximum prediction differenceabsolute value is “500”.

Then, the quantization width setting unit 104 sets a quantization widthQ by using the data table DT110 in FIG. 8 that is stored in the internalmemory and the maximum prediction difference absolute value of “500”.

If the maximum prediction difference absolute value is “500”, then it isincluded in a value range from “256” to “511” indicated in the datatable DT110. Therefore, the quantization width Q is set to “2”. The setquantization width Q of “2” is set to correspond to the three pixelsbelonging to the group to be processed (the group G2).

Furthermore, the quantization width setting unit 104 provides thequantization width information Code to the packing unit 106. In thiscase, since the maximum prediction difference absolute value of “500” isincluded in a value range from “256” to “511” indicated in the datatable DT110, the quantization width information Code is informationindicating the code “100”.

Furthermore, in receiving the quantization width information Code, thepacking unit 106 stores the received quantization width information Codeto the internal memory.

Then, Step S119 described earlier is performed. At Step S119, it isassumed that a maximum code-added prediction difference binary number of“10” among three code-added prediction difference binary numberscorresponding to the respective three pixels belonging to the group tobe processed (the group G2) is provided to the surplus bit count unit105.

Then, the surplus bit counter updating processing at Step S120 isperformed.

At Step S121, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe received code-added prediction difference binary number is “10” andthe reference bit width M is 8 bits. Under the assumption, thedetermination at Step S121 is NO, and therefore the processing proceedsto Step S123.

At Step S123, the surplus bit count unit 105 determines whether or notthe received code-added prediction difference binary number is greaterthan the reference bit width M, and whether or not a value of thesurplus bit counter is greater than “0”. If the determinations at StepS123 are YES, then the processing proceeds to Step S124.

Here, it is assumed that the code-added prediction difference binarynumber (“10”) is greater than the reference bit width M of “8”.Furthermore, it is assumed that the surplus bit counter indicates “3” asa result of the above-described processing. Under the assumption, thedetermination at Step S123 is YES, and therefore the processing proceedsto Step S124.

At Step S124, the surplus bit count unit 105 determines whether or notthe value of the surplus bit counter is greater than the quantizationwidth Q corresponding to the p-th pixel belonging to group to beprocessed (for example, the group G2). If the determination at Step S124is YES, then the processing proceeds to Step S124N. On the other hand,if the determination at Step S124 is NO, then the processing proceeds toStep S125 as described later.

Here, it is assumed that the surplus bit counter indicates “3”.Furthermore, it is assumed that the quantization width Q correspondingto the p-th pixel belonging to the group to be processed is set to “2”.Under the assumption, the determination at Step S124 is YES, andtherefore the processing proceeds to Step S124N.

At Step S124N, counter value decrement processing is performed. In thecounter value decrement processing, the surplus bit count unit 105decrements the value (for example, “3”) indicated by the surplus bitcounter by the value (for example, “2”) of the quantization width Qcorresponding to the p-th pixel belonging to the group to be processed.

Furthermore, the surplus bit count unit 105 provides counter decrementvalue information to the quantization width setting unit 104. Thecounter decrement value information is information indicating a value(for example, “2”) by which the value of the surplus bit counter isdecremented. In this case, the counter decrement value informationindicates the number of surplus bit(s) available in the processingdescribed later.

In receiving the counter decrement value information, the quantizationwidth setting unit 104 provides the received counter decrement valueinformation to the quantization processing unit 108.

At Step S124NA, quantization width zero setting processing is performed.In the quantization width zero setting processing, the surplus bit countunit 105 issues quantization width zero change instruction to thequantization width setting unit 104. The quantization width zero changeinstruction is instruction for setting the quantization width Qcorresponding to the p-th pixel belonging to the group to be processed,to “0”.

Then, the surplus bit counter updating processing is completed, and theprocessing returns to the image coding processing in FIG. 2 again andproceeds to Step S130.

In receiving the quantization width zero change instruction, thequantization width setting unit 104 changes a value (for example, “2”)of a quantization width Q corresponding to a pixel (for example, thepixel P6) designated by the quantization width zero change instruction,to “0”.

At Step S130, the same processing as described previously is performed,so that the details are not explained again. It is assumed that, by theprocessing, the quantization width Q of “0” and the predictiondifference value which correspond to the first pixel belonging to thegroup to be processed are provided to the quantization processing unit108.

At Step S131, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed that avalue of the quantization width Q corresponding to the p-th pixelbelonging to the group to be processed is “0” and that the processingproceeds to Step S133.

At Step S133, the above-described coding processing is performed. Here,it is assumed that the quantization processing unit 108 receives aquantization width Q of “0” from the quantization width setting unit104, and receives the counter decrement value information. Under theassumption, the processing NB described below is performed in the codingprocessing.

In the processing NB, the quantization processing unit 108 generatesdata (hereinafter, referred to as “coded image data”) that expresses aprediction difference value received from the quantization width settingunit 104, by bits (reference bit width M+a value indicated by thecounter decrement value information).

Then, the quantization processing unit 108 provides the generated codedpixel data to the packing unit 106.

In addition, the received prediction difference value is assumed to be“270”. It is assumed that the reference bit width M is 8 bits.Furthermore, the value indicated by the counter decrement valueinformation is assumed to be “2”. Under the assumption, the quantizationprocessing unit 108 generates a piece of coded pixel data that expressesthe prediction difference value of “270” by “10” bits. Morespecifically, the number of bits used to generate the piece of codedpixel data is “10” as indicated in FIG. 9A.

As described above, the value indicated by the counter decrement valueinformation is the number of available surplus bits. Therefore, if thevalue indicated by the counter decrement value information is “2”, thegenerated piece of coded pixel data is a piece of data generated byusing two surplus bits.

Then, the determination at Step S134 is NO, and therefore thequantization width setting unit 104 increments the value of p by “1”.Then, Step S119 is performed again. It is assumed that, by theprocessing, the code-added prediction difference binary number of “10”corresponding to the pixel P7 is provided to the surplus bit count unit105.

Then, the surplus bit counter updating processing at Step S120 isperformed.

At Step S121, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe received code-added prediction difference binary number is “10” andthe reference bit width M is 8 bits. Under the assumption, thedetermination at Step S121 is NO, and therefore the processing proceedsto Step S123.

At Step S123, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe received code-added prediction difference binary number (“10”) isgreater than the reference bit width M of “8”. Here, it is assumed thatthe surplus bit counter indicates “1”. Under the assumption, thedetermination at Step S123 is YES, and therefore the processing proceedsto Step S124.

At Step S124, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe surplus bit counter indicates “1”. Furthermore, it is assumed that aquantization width Q corresponding to the p(2)-th pixel belonging to thegroup (for example, the group G2) to be processed is set to “2”. Underthe assumption, the determination at Step S124 is NO, and therefore theprocessing proceeds to Step S125.

At Step S125, quantization width change processing N is performed. Inthe quantization width change processing N, the surplus bit count unit105 issues quantization width change instruction N to the quantizationwidth setting unit 104. The quantization width change instruction N isinstruction for changing a quantization width Q (for example, “2”)corresponding to the p-th pixel belonging to the group to be processed,to a value generated by subtracting the quantization width Q by a value(for example, “1”) of the surplus bit counter.

In receiving the quantization width change instruction N, thequantization width setting unit 104 changes the quantization width Q(for example, “2”) corresponding to the p-th pixel belonging to thegroup to be processed, to a value generated by subtracting thequantization width Q by the value (for example, “1”) of the surplus bitcounter.

At Step S125N, the surplus bit count unit 105 sets the value indicatedby the surplus bit counter to “0”.

Furthermore, the surplus bit count unit 105 provides the counterdecrement value information to the quantization width setting unit 104.The counter decrement value information is information indicating avalue (for example, “1”) by which the value of the surplus bit counteris decremented. In this case, the counter decrement value informationindicates the number of surplus bits available in the processingdescribed later.

In receiving the counter decrement value information, the quantizationwidth setting unit 104 provides the received counter decrement valueinformation to the quantization processing unit 108.

Then, the surplus bit counter updating processing is completed, and theprocessing returns to the image coding processing in FIG. 2 again andproceeds to Step S130.

At Step S130, the same processing as described previously is performed,so that the details are not explained again. It is assumed that, by theprocessing, the quantization width Q of “1” and the predictiondifference value which correspond to the second pixel belonging to thegroup to be processed are provided to the quantization processing unit108.

At Step S131, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed that avalue of the quantization width Q corresponding to the second pixelbelonging to the group to be processed is “1” and that the processingproceeds to Step S132.

Hereinafter, a quantization width Q indicating a value of 1 or greateris referred to as a “non-zero quantization width Q”.

At Step S132, quantization processing is performed. In the quantizationprocessing, the quantization processing unit 108 quantizes a predictiondifference value corresponding to a non-zero quantization width Qcorresponding to the p-th pixel belonging to the group to be processed,by dividing the prediction difference value by the Q-th power of 2.Hereinafter, a value generated by quantization is referred to as a“quantized value”.

Here, the p-th pixel belonging to the group to be processed is assumedto be the pixel P7. Furthermore, it is assumed that the quantizationwidth Q corresponding to the prediction difference value of “−500”corresponding to the pixel P7 indicates “1”. Under the assumption, thequantization processing unit 108 obtains a quantized value of “−250”, bydividing the prediction difference value of “−500” by the first power of2 (2).

At Step S133, the above-described coding processing is performed. Here,it is assumed that the quantization processing unit 108 receives aquantization width Q of “1” from the quantization width setting unit104, and receives the counter decrement value information. Under theassumption, the processing NC described below is performed in the codingprocessing.

In the processing NC, the quantization processing unit 108 generatesdata (hereinafter, referred to as “coded image data”) that expresses aquantized value by bits (reference bit width M+a value indicated by thecounter decrement value information). As described above, the value ofthe counter decrement value information is the number of availablesurplus bit(s). Therefore, by the processing, the resulting coded pixeldata is data generated by using surplus bit(s).

Then, the quantization processing unit 108 provides the generated codedpixel data to the packing unit 106.

Here, the quantized value is assumed to be “−250”. It is also assumedthat the reference bit width M is 8 bits. Furthermore, the valueindicated by the counter decrement value information is assumed to be“1”. Under the assumption, the quantization processing unit 108generates the coded pixel data that expresses the quantized value of“−250” by “9” bits. More specifically, the number of bits used togenerate the coded pixel data is “9” as indicated in FIG. 9A.

Then, the determination at Step S134 is NO, and therefore thequantization width setting unit 104 increments the value of p by “1”.Then, Step S119 is performed again. It is assumed that, by theprocessing, a code-added prediction difference binary number of “10” isprovided to the surplus bit count unit 105.

Then, the surplus bit counter updating processing at Step S120 isperformed.

At Step S121, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe received code-added prediction difference binary number is “10” andthe reference bit width M is 8 bits. Under the assumption, thedetermination at Step S121 is NO, the determination at Step S123 is NO,thereby the surplus bit counter updating processing is completed, andthe processing returns to the image coding processing in FIG. 2 again,and proceeds to Step S130.

At Step S130, the same processing as described previously is performed,so that the details are not explained again. It is assumed that, by theprocessing, the quantization width Q of “2” and the predictiondifference value which correspond to the third pixel belonging to thegroup to be processed are provided to the quantization processing unit108.

At Step S131, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed that avalue of the quantization width Q corresponding to the p-th pixelbelonging to the group to be processed is “2” and that the processingproceeds to Step S132.

At Step S132, the same processing as described previously is performed,so that the details are not explained again.

Here, the p-th pixel belonging to the group to be processed is assumedto be the pixel P8. Furthermore, it is assumed that the quantizationwidth Q corresponding to the prediction difference value of “−66”corresponding to the pixel P8 indicates “2”. Under the assumption, thequantization processing unit 108 obtains a quantized value of “−16”, bydividing the prediction difference value of “−66” by the second power of2 (4).

At Step S133, the above-described coding processing is performed. Here,it is assumed that the quantization processing unit 108 receives aquantization width Q of “2” from the quantization width setting unit104, and receives the counter decrement value information. Under theassumption, the quantization processing unit 108 generates data(hereinafter, referred to as “coded pixel data”) that expresses aquantized value by the reference bit width M.

Then, the quantization processing unit 108 provides the generated codedpixel data to the packing unit 106.

Under the assumption, the quantization processing unit 108 generates apiece of coded pixel data that expresses the prediction difference valueof “−16” by “8” bits. More specifically, the number of bits used togenerate the piece of coded pixel data is “8” as indicated in FIG. 9A.

Then, the generated piece of coded pixel data is provided to the packingunit 106. Here, the packing unit 106 stores the received piece of codedpixel data to the internal memory.

Then, the determination at Step S134 is YES, and therefore thequantization width setting unit 104 sets the value of p to “1” and StepS135 is performed.

At Step S135, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe number of the received piece(s) of pixel data is not equal to thepredetermined value Pix. Therefore, Step S113 is performed again.

In this case, the internal memory in the packing unit 106 holdsconsecutive pieces of data as shown in FIG. 9B from the piece of initialpixel value data corresponding to the pixel P1 to the piece of the codedpixel data corresponding to the pixel P8 which are shown in FIG. 9B.

Then, at least a part of Steps S113 to S134 is repeated until thedetermination at Step S135 is YES.

If the determination at Step S135 is YES, then the processing proceedsto Step S136.

At Step S136, packing processing is performed. In the packingprocessing, the packing unit 106 generates data (coded data) by thefixed bit width (s bits) which includes plural pieces of data (forexample, pieces of data shown in FIG. 9B) stored in the internal memory.In other words, the packing unit 106 generates coded data having apredetermined coding amount. Here, if there is/are any not-used bit(s)in the s-bit coded data, the packing unit 106 replaces the not-usedbit(s) by dummy data.

The generated coded data includes, for example as shown in FIG. 9B, oneor more pieces of initial pixel value data, Pix pieces of coded pixeldata, and pieces of quantization width information Code (each 3 bits).Pix has already been explained, so that it will not be explained againbelow.

Moreover, the packing unit 106 stores the generated piece of coded dataeach having the fixed bit width (s bits) into an external memory notshown. Here, each time of repeating Step S136, the packing unit 106stores a generated piece of coded data into the external memory so thatthe pieces of coded data is consecutively stored with pieces of codeddata which have already been stored in the external memory.

At Step S137, the surplus bit count unit 105 sets the value indicated bythe surplus bit counter to “0”.

At Step S138, the packing unit 106 determines whether or not codingprocessing is completed for the entire to-be-coded picture. If thedetermination at Step S138 is YES, then the image coding processing iscompleted. On the other hand, if the determination at Step S138 is NO,then Step S113 is performed again.

Then, at least a part of Steps S113 to S137 is repeated until thedetermination at Step S138 is YES. Thereby, pieces of coded data eachhaving the fixed bit width (s bits) are stored consecutively in theexternal memory. In this case, the pieces of coded data stored in theexternal memory are pieces of data used to reconstruct a picture.

By the above-described processing, the first embodiment can offer thefollowing advantages in comparison to coding processing without usingsurplus bits (hereinafter, referred to as “processing without usingsurplus bits”) which has been described with reference to FIGS. 7A and7B.

As shown in FIG. 7A and 9A, for example, in the processing without usingsurplus bits, the prediction difference value of “270” corresponding tothe pixel P6 is quantized by the quantization width Q of “2” (by thesecond power of 2=4). In this case, in the processing without usingsurplus bits, the quantization causes a quantization error of “3” atmaximum.

On the other hand, in the first embodiment, the prediction differencevalue of “270” corresponding to the pixel P6 can be expressed by 10 bitswhich are the reference bit width M (8 bits) and two surplus bits.Therefore, processing for quantizing the prediction difference value of“270” is not necessary. Therefore, the quantization error is suppressedto “0”.

Moreover, for example, in the processing without using surplus bits, theprediction difference value of “−500” corresponding to the pixel P7 isquantized by the quantization width Q of “2” (by the second power of2=4). In this case, in the processing without using surplus bits, thequantization causes a quantization error of “3” at maximum.

On the other hand, in the first embodiment, the prediction differencevalue of “−500” corresponding to the pixel P7 can be expressed by 9 bitswhich are the reference bit width M (8 bits) and one surplus bit. Inthis case, if the prediction difference value of “−500” is quantized bythe quantization width Q of “1” (by the first power of 2=2), thequantized value of “−250” can be expressed by 9 bits. In this case, thequantization error can be suppressed to “1” at maximum.

More specifically, when a pixel quantized by the quantization width Q of“2” shown in FIG. 7A (for example, a pixel at a sharp edge portion) isto be coded, the coding is performed using surplus bits in the firstembodiment. Therefore, in the first embodiment, it is possible to reducethe quantization processing, or decrease the quantization width Q in thequantization processing (for example, decrease “2” to “1”). Therefore,it is possible to suppress deterioration of image quality caused byquantization errors. In other words, it is possible to reduce a degreeof deterioration of image quality caused by coding.

In addition, in the first embodiment, pieces of coded data each havingthe fixed bit width (s bits) are consecutively stored in the externalmemory. One piece of coded data includes pieces of coded pixel datanecessary for reconstructing a picture. Therefore, if it is required toaccess a certain piece of coded pixel data, it is necessary only toaccess a piece of coded data including the piece of coded pixel data.Therefore, random accessibility for data can be kept.

Furthermore, the fixed bit width (s bits) is set to a bus width of datatransfer of a used integrated circuit. The fixed length of the bus widthcan be secured. Therefore, implementation is possible without losingrandom accessibility.

As described above, the first embodiment can reduce a degree ofdeterioration of image quality while keeping random accessibility.

It should be noted that the image coding processing according to thefirst embodiment may be implemented as a hardware of a Large ScaleIntegration (LSI).

(Image Decoding Processing)

Next, the image decoding processing according to the first embodiment isdescribed in detail.

As shown in FIG. 1, the image decoding device 110 includes a fixed bitwidth setting unit 117, an unpacking unit 116, a quantization widthsetting unit 114, a surplus bit count unit 115, an output unit 119, andan inverse quantization processing unit 118. It should be noted that allor a part of units included in the image decoding device 110 may beimplemented as hardware. It should also be noted that all or a part ofunits included in the image decoding device 110 may be implemented asmodule(s) of a program executed by a Central Processing Unit (CPU) orthe like.

The surplus bit count unit 115 includes a surplus bit counter RCindicating the number of surplus bits. The surplus bit counter RCindicates “0” in an initial state.

Here, it is assumed that pieces of coded data each having the fixed bitwidth (s bits) are consecutively stored in an external memory not shown,by the image coding processing shown in FIG. 2 which has been describedpreviously. It is also assumed that a memory (not shown) in which datais stored is provided in the packing unit 116 in the image decodingdevice 110.

Here, it is assumed that a memory (not shown) in which data is stored isprovided in the quantization width setting unit 114 in the image codingdevice 110 in FIG. 1. It is assumed that the data table DT110 in FIG. 8is previously stored in the quantization width setting unit 114.

FIG. 10 is a flowchart of the image decoding processing. In the imagedecoding processing in FIG. 10, Step S211 is first performed.

At Step S211, the fixed bit width setting unit 117 sets a fixed bitwidth (s bits). The fixed bit width is set to a bit amount (for example,256 bits) of coded data having a predetermined coding amount which isgenerated by the image coding processing in FIG. 2. The fixed bit widthmay be, for example, set to a bus width of data transfer of a usedintegrated circuit. Then, the fixed bit width setting unit 117 providesthe fixed bit width information indicating the fixed bit width (s bits)to the unpacking unit 116, the quantization width setting unit 114, andthe surplus bit count unit 115.

At Step S212, the quantization width setting unit 114 calculates thereference bit width M according to the equation (8), as describedearlier. Here, it is assumed that the calculated reference bit width Mis “8”. The quantization width setting unit 114 provides the calculatedreference bit width M to the surplus bit count unit 115.

At Step S213, coding data obtainment processing is performed. In thecoding data obtainment processing, the unpacking unit 116 obtains thet-th piece of coded data among the pieces of coded data consecutivelystored in the external memory. Here, an initial value of t is “1”. Itshould be noted that the obtainment processing is not limited to themethod of obtaining the piece of coded data from the external memory.For example, the piece of coded data may be obtained from the packingunit 106.

Here, when the t-th coded data is obtained, the unpacking unit 116increments the value of t by “1”.

At Step S213N, unpacking processing is performed. In the unpackingprocessing, the unpacking unit 116 unpacks the obtained t-th coded data.In other words, pieces of data are obtained from the piece of codeddata. Then, the unpacking unit 116 stores the obtained pieces of datainto an internal memory. In this case, it is assumed that pieces of dataare consecutively stored in the internal memory as shown in FIG. 9B.

After that, as the method of obtaining a piece of pixel data, theunpacking unit 116 obtains the g-th piece of pixel data by reading theg-th piece of pixel data among the pieces of pixel data stored in theinternal memory. Here, an initial value of a is “1”. g indicates thenumber of pieces of pixel data which are obtained by the unpacking unit116.

For example, the first to eleventh pieces of pixel data are 11 pieces ofpixel data corresponding to the respective pixels P1 to P11 shown inFIG. 9B. Each of the 11 pieces of pixel data is a piece of initial pixelvalue data or a piece of coded pixel data.

Hereinafter, a pixel corresponding to the g-th piece of pixel data whichis obtained by the unpacking unit 116 is referred to as a “to-be-decodedpixel”. The to-be-decoded pixel is a pixel to be decoded.

At Step S214, the unpacking unit 116 determines whether or not a pieceof image data corresponding to a to-be-decoded pixel is a piece ofinitial pixel value data. If the determination at Step S214 is YES, thenthe processing proceeds to Step S213NA.

At Step S213NA, initial pixel value data obtainment processing isperformed. In the initial pixel value data obtainment processing, theunpacking unit 116 obtains a piece of initial pixel value data, byreading, from the internal memory, the piece of initial pixel value dataamong the pieces of pixel data stored in the internal memory.

When the piece of pixel data as a piece of initial pixel value data isobtained, the unpacking unit 116 provides the obtained piece of pixeldata to the output unit 119. Then, the processing proceeds to Step S235that will be described later. On the other hand, if the determination atStep S214 is YES, then the processing proceeds to Step S215.

Here, when the piece of initial pixel value data is received, the outputunit 119 stores the received piece of initial pixel value data into anexternal memory. It should be noted that the output unit 119 may outputthe received piece of initial pixel value data not to the externalmemory to store the received piece in the external memory, but to anexternal circuit or the like which processes image.

Here, it is assumed that the obtained piece of pixel data is a piece ofinitial pixel value data, and therefore the processing proceeds to StepS235.

At Step S235, the unpacking unit 116 determines whether or not thenumber (g) of obtained pieces of pixel data is equal to thepredetermined value Pix. Each of the obtained pieces of pixel data is apiece of initial pixel value data or a piece of coded pixel data. Pixrepresents the number of pixels to be included in coded data (packingdata) having the fixed bit width (s bits), as described previously. Avalue of Pix is, for example, “26”.

If the determination at Step S235 is YES, then the unpacking unit 116sets a value of g to “1” and the processing proceeds to Step S237. Onthe other hand, if the determination at Step S235 is NO, then theunpacking unit 116 increments the value of g by “1”. Then, Step S214 isperformed again. Here, it is assumed that it is determined that thenumber (g) of the obtained pieces of pixel data is not equal to thepredetermined value Pix, and therefore Step S214 is performed again.

Here, it is assumed that the piece of pixel data corresponding to theto-be-decoded pixel is a piece of initial pixel value data correspondingto the pixel P2.

Under the assumption, the determination at Step S214 is YES, and at StepS213NA, the unpacking unit 116 obtains a piece of pixel data (a piece ofpixel data corresponding to the pixel P2) as a piece of initial pixelvalue data. Then, the unpacking unit 116 provides the obtained piece ofpixel data as a piece of initial pixel value data to the output unit119, and the processing proceeds to Step S235.

Here, when the piece of initial pixel value data is received, the outputunit 119 stores the received piece of initial pixel value data into theexternal memory.

Then, Step S235 described previously is performed to increment the valueof g by “1”, and then Step S214 is performed again.

Next, it is assumed that the piece of pixel data corresponding to theto-be-decoded pixel is a piece of pixel data corresponding to the pixelP3 as a piece of coded pixel data. Under the assumption, thedetermination at Step S214 is NO, and therefore the processing proceedsto Step S215.

At Step S215, prediction value calculation processing R is performed tocalculate a prediction value of a to-be-decoded pixel. In the predictionvalue calculation processing R, the following calculation processing RAis performed when the (g-1)th pixel data is a piece of initial pixelvalue data.

In the calculation processing RA, the unpacking unit 116 calculates aprediction value of the to-be-decoded pixel, by using an equation havingthe same meaning as that of the prediction equation (1) used incalculating the prediction value at Step S115 in the image codingprocessing in FIG. 2. In other words, when the g-th pixel data is to bedecoded, the unpacking unit 116 sets the prediction value of theto-be-decoded pixel to a value indicated by the (g-1)th pixel data.

Here, it is assumed that the piece of pixel data to be decoded is apiece of pixel data corresponding to the pixel P3. Under the assumption,a value of “220” indicated by a piece of pixel data corresponding to thepixel P2 is a prediction value.

In the prediction value calculation processing R, if the (g-1)th pixeldata is not a piece of initial pixel value data, the followingcalculation processing RB is performed.

At Step S216, the unpacking unit 116 determines whether or not the pieceof pixel data corresponding to the to-be-decoded pixel is the firstpiece of pixel data in a group. The first piece of pixel data in thegroup is a piece of pixel data corresponding to the first pixel of threepixels belonging to the c-th group among pieces of pixel data stored inthe internal memory. Here, an initial value of c is “1”.

For example, the first, second, and third groups are the groups G1, G2,and G3, respectively, shown in FIG. 9B. Moreover, when the c-th group isthe group G1, the first, second, and third pixels belonging to the groupG1 are the pixels P3, P4, and P5, respectively.

If the determination at Step S216 is YES, then the processing proceedsto Step S217. On the other hand, if the determination at Step S216 isNO, then the processing proceeds to Step S220 as described later.

Here, the obtained piece of pixel data is assumed to be the first pieceof pixel data in the group. Under the assumption, the processingproceeds to Step S217.

At Step S217, the unpacking unit 116 obtains quantization widthinformation Code corresponding to the c-th group from pieces of datastored in the internal memory, by reading the quantization widthinformation Code from the internal memory. Then, the unpacking unit 116provides the obtained quantization width information Code to thequantization width setting unit 114. Here, an initial value of c is “1”.

For example, the first, second, and third groups are the groups G1, G2,and G3, respectively, shown in FIG. 9B. Here, it is assumed thatquantization width information Code (“001”) corresponding to the groupG1 is obtained.

At Step S218, quantization width setting processing is performed. In thequantization width setting processing, the quantization width settingunit 114 sets a quantization width Q by using (a) the data table DT110in FIG. 8 stored in the internal memory and (b) the code indicated bythe quantization width information Code provided from the unpacking unit116, and also calculates a surplus bit number.

The set quantization width Q is a quantization width set for the threepixels belonging to the c-th group. Furthermore, the calculated surplusbit number is the number of surplus bits corresponding to each of thethree pixels belonging to the c-th group.

Here, the received quantization width information Code is assumed toindicate a code of “001”. The code of “001” is associated with thequantization width Q of “0” and the surplus bit number of “1” in thedata table DT110. In this case, the quantization width Q is set to “0”.Furthermore, the calculated surplus bit number is “1”.

Then, the quantization width setting unit 114 provides quantizationinformation indicating the set quantization width Q and the calculatedsurplus bit number, to the surplus bit count unit 115.

At Step S220, surplus bit counter updating processing R is performed.

FIG. 11 is a flowchart of the surplus bit counter updating processing R.As shown in FIG. 11, in the surplus bit counter updating processing R,Step S221 is first performed.

At Step S221, the surplus bit count unit 115 determines whether or notthe quantization width Q indicated in the received quantizationinformation is “0” and whether or not the surplus bit number indicatedin the received quantization information is greater than “0”. If thedetermination at Step S221 is YES, then the processing proceeds to StepS222. On the other hand, if the determination at Step S221 is NO, thenthe processing proceeds to Step S223 as described later.

Here, it is assumed that the quantization width Q indicated in thereceived quantization information is “0”. It is also assumed that thesurplus bit number indicated in the received quantization information is“1”. Under the assumption, the determination at Step S221 is YES, andtherefore the processing proceeds to Step S222.

At Step S222, counter value increment processing R is performed. In thecounter value increment processing R, the surplus bit count unit 115increments a value indicated by the surplus bit counter RC by thesurplus bit number indicated in the received quantization information.By the above processing, the surplus bit counter RC is assumed toindicate “1”.

Then, the surplus bit counter updating processing R is completed, andthe processing returns to the image decoding processing in FIG. 10 againand proceeds to Step S219.

At Step S219, coded pixel data obtainment processing R is performed. Inthe coded pixel data obtainment processing R, the unpacking unit 116performs the following obtainment processing RA when a counter decrementvalue information R described later is not received from thequantization width setting unit 114.

In the obtainment processing RA, the unpacking unit 116 sets, for eachpixel, a bit number of a piece of pixel data that is coded, by usingsurplus bit(s) based on (a) the data table DT110 of FIG. 8 stored in theinternal memory and (b) the code indicated by the obtained quantizationwidth information Code.

Here, the received quantization width information Code is assumed toindicate a code of “001”. The code of “001” is associated with acode-added prediction difference binary digit number of “7” in the datatable DT110. In this case, the number of bits used in a piece of pixeldata read by the unpacking unit 116 from the internal memory is “7”.

In other words, when pieces of pixel data are stored in an order fromthe left side in the internal memory as shown in FIG. 9B, the unpackingunit 116 obtains a piece of pixel data of the pixel P3, by reading, asthe piece of pixel data of the pixel P3, the first to seventh bits.Then, the unpacking unit 116 provides the obtained piece of pixel datato the quantization width setting unit 114.

Here, in the coded pixel data obtainment processing R, the unpackingunit 116 performs the following obtainment processing RB, when counterdecrement value information R described lather is received from thequantization width setting unit 114.

At Step S230, data transmission processing R is performed. In the datatransmission processing R, the quantization width setting unit 114provides the inverse quantization processing unit 118 with thequantization width Q corresponding to the to-be-decoded pixel, theobtained piece of pixel data, and the calculated prediction value of theto-be-decoded pixel.

At Step S231, decoding processing is performed. In the decodingprocessing, the inverse quantization processing unit 118 performs thefollowing processing RA when counter decrement value information Rdescribed lather is not received.

In the processing RA, the inverse quantization processing unit 118generates a piece of data (hereinafter, referred to as a “piece ofdecoded data) that expresses a value indicated by the received piece ofpixel data by a code-added binary digit number of a dynamic range of thepiece of pixel data received by the pixel data receiving unit 101. Morespecifically, since a dynamic range of a piece of pixel data in thefirst embodiment is 12 bits, a piece of 13-bit decoded data isgenerated.

Then, the inverse quantization processing unit 118 provides the outputunit 119 with the generated piece of decoded data and the calculatedprediction value of the to-be-decoded pixel.

Here, it is assumed that a value indicated by the received piece ofpixel data is “40”. Furthermore, the received piece of pixel data isassumed to be 7-bit data. Under the assumption, the inverse quantizationprocessing unit 118 generates a piece of decoded data that expresses, by13 bits, a value of “40” indicated by the received piece of pixel data.

Here, in the decoding processing, when the counter decrement valueinformation R described later is received, the inverse quantizationprocessing unit 118 performs the processing RB described later.

At Step S232, the quantization width setting unit 114 determines whetheror not the quantization width Q corresponding to the to-be-decoded pixelis “0”. If the determinations at Step S232 are YES, then the processingproceeds to Step S234. On the other hand, if the determination at StepS232 is NO, then the processing proceeds to Step S233 as describedlater. Here, it is assumed that the quantization width Q correspondingto the to-be-decoded pixel is “0”, and therefore the processing proceedsto Step S234.

At Step S234, output processing is performed. In the output processing,when the output unit 119 receives a piece of decoded data, the outputunit 119 generates a piece of decoded pixel data that indicates a valuegenerated by adding (a) the value which is indicated by the receivedpiece of decoded data with (b) the prediction value of the to-be-decodedpixel which is calculated in the prediction value calculation processingR at Step S215. Then, the output unit 119 stores the generated piece ofdecoded pixel data to an external memory. In addition, the output unit119 provides the generated piece of decoded pixel data to the unpackingunit 116.

It should be noted that the output unit 119 may output the generatedpiece of decoded pixel data not to the external memory to store thegenerated piece in the external memory, but to an external circuit orthe like which processes image.

Here, it is assumed that the value indicated by the piece of decodeddata is “40”. It is also assumed that the calculated prediction value ofthe to-be-decoded pixel is “220” that is the pixel value of the pixel P2because the (g-1)th pixel data is a piece of initial pixel value data.

More specifically, in the output processing, the output unit 119generates a piece of decoded pixel data which indicates a value that isgenerated by adding the value indicated by the piece of pixel dataobtained as the prediction value to the value indicated by the receivedpiece of decoded data.

In this case, the generated piece of decoded pixel data indicates “260”.In other words, the generated piece of decoded pixel data is a piece ofpixel data indicating a pixel value of the pixel P3 shown in FIG. 9A.

Then, Step S235 described previously is performed to increment the valueof g by “1”, and then Step S214 is performed again.

Next, it is assumed that a piece of pixel data corresponding to theto-be-decoded pixel is a piece of pixel data corresponding to the pixelP4 as a piece of coded pixel data. Under the assumption, thedetermination at Step S214 is NO, and therefore the processing proceedsto Step S215.

Next, prediction value calculation processing R at Step S215 isperformed. Here, it is assumed that the (g-1)th pixel data is not apiece of initial pixel value data. Under the assumption, in theprediction value calculation processing R, the following calculationprocessing RB is performed.

In the calculation processing RB, it is assumed that the unpacking unit116 sets the prediction value of the to-be-decoded pixel to a pixelvalue indicated by the piece of decoded pixel data provided from theoutput unit 119. Here, it is assumed that the piece of decoded pixeldata provided from the output unit 119 is a piece of pixel dataindicating the pixel value of the pixel P3 shown in FIG. 9A. Under theassumption, the prediction value of the to-be-decoded pixel is “260”.

Furthermore, when prediction values of all pixels belonging to theabove-described c-th group have been calculated, the unpacking unit 116increments a value of c by “1”.

At Step S216, the same processing as described previously is performed,so that the details are not explained again. Here, it is assumed thatthe determination at Step S216 is NO, and therefore the processingproceeds to Step S220.

Then, again, Steps S221 and S222 in FIG. 11 are performed, and therebythe value indicated by the surplus bit counter RC is assumed to be “2”.

Then, the surplus bit counter updating processing R is completed, thenthe processing returns to the image decoding processing in FIG. 10again, and Step S230 is performed again. At the step, the quantizationwidth Q of “0” corresponding to the to-be-decoded pixel, the obtainedpiece of pixel data, and the calculated prediction value of “260” of theto-be-decoded pixel are provided to the inverse quantization processingunit 118.

Then, at Step S219, coded pixel data obtainment processing R isperformed. Here, it is assumed that the obtainment processing RA isperformed in the same manner as described previously.

Then, at Step S231, decoding processing is performed. Here, it isassumed that the processing RA is performed in the same manner asdescribed previously.

In the processing RA, the inverse quantization processing unit 118generates a piece of decoded data that expresses the value of “20”indicated by the received piece of pixel data, by a code-added binarydigit number (13) of a dynamic range of the piece of pixel data receivedby the pixel data receiving unit 101.

Then, the inverse quantization processing unit 118 provides thegenerated piece of decoded data to the output unit 119.

Then, the determination at Step S232 is YES, and therefore Step S234 isperformed in the same manner as described previously. At the step, theoutput unit 119 generates a piece of decoded pixel data indicating apixel value of “280” of the pixel P4, and stores the generated piece ofdecoded pixel data into an external memory. In addition, the output unit119 provides the generated piece of decoded pixel data to the unpackingunit 116.

Then, Step S235 described previously is performed to increment the valueof g by “1”, and then Step S214 is performed again.

Then, the processing proceeds to Step S215. At the steps, a predictionvalue of “280” of the to-be-decoded pixel is calculated. At this timing,prediction values of all pixels belonging to the group G1 have beencalculated. Therefore, the unpacking unit 116 increments the value of cby “1”. Here, it is assumed that the value of c is “2”.

Then, Step S216 and Steps 221 and S222 in FIG. 11 are performed, andthereby the value indicated by the surplus bit counter RC is assumed tobe “3”.

In addition, Steps S219, S230, S231, S232, and S234 are performed in thesame manner as described previously. At the steps, a piece of decodedpixel data which indicates a pixel value of “320” is generated, and thegenerated piece of decoded pixel data is provided to the unpacking unit116.

Then, Step S235 described previously is performed to increment the valueof g by “1”, and then Step S214 is performed again.

Then, the processing proceeds to Step S215. At the steps, a predictionvalue of “320” of the to-be-decoded pixel is calculated.

Here, the piece of pixel data corresponding to the to-be-decoded pixelis the above-described first piece of pixel data in the group. The pieceof pixel data is assumed to be a piece of coded pixel data having 10bits which corresponds to the pixel P6 shown in FIG. 9B. In other words,the piece of pixel data corresponding to the to-be-decoded pixel is apiece of pixel data corresponding to the first pixel belonging to thegroup G2.

Under the assumption, the determination at Step S216 is YES, andtherefore Step S217 is performed. At the step, the unpacking unit 116obtains quantization width information Code corresponding to the secondgroup (the group G2) from pieces of data stored in the internal memory,by reading the quantization width information Code from the internalmemory. Here, the obtained quantization width information Code isassumed to indicate a code of “100”.

In the quantization width setting processing at Step S218, the sameprocessing as described previously is performed, so that the details arenot explained again. In this processing, the quantization width Q is setto “2”. Furthermore, the calculated surplus bit number is “0”.

In this case, the set quantization width Q is a quantization width setfor the three pixels belonging to the second group. Furthermore, thecalculated surplus bit number is the number of surplus bit(s)corresponding to each of the three pixels belonging to the second group.

Then, the quantization width setting unit 114 provides quantizationinformation indicating the set quantization width Q and the calculatedsurplus bit number, to the surplus bit count unit 115.

Then, Step S221 in FIG. 11 is performed again. Here, the determinationat Step S221 is NO, and therefore the processing proceeds to Step S223.

At Step S223, the surplus bit count unit 115 determines whether or notthe value of the surplus bit counter is greater then the quantizationwidth Q indicated by the received quantization information. If thedetermination at Step S223 is YES, then the processing proceeds to StepS224. On the other hand, if the determination at Step S223 is NO, thenthe processing proceeds to Step S226 as described later.

Here, it is assumed that the value of the surplus bit counter RC is “3”.It is also assumed that the quantization width Q indicated in thereceived quantization information is “2”. Under the assumption, thedetermination is YES, and therefore the processing proceeds to StepS224.

At Step S224, counter value decrement processing R is performed. In thecounter value decrement processing R, the surplus bit count unit 115decrements the value (for example, “3”) of the surplus bit counter RC bya value (for example, “2”) of the quantization width Q indicated by thereceived quantization information. By the step, the surplus bit counterRC is assumed to indicate “1”.

Furthermore, the surplus bit count unit 115 provides the counterdecrement value information R to the quantization width setting unit114. The counter decrement value information R is information indicatinga value (for example, “2”) by which the value of the surplus bit counterRC is decremented. In this case, the counter decrement value informationR indicates the number of surplus bits available in the processingdescribed later.

When the counter decrement value information R is received, thequantization width setting unit 114 provides the received counterdecrement value information R to the inverse quantization processingunit 118 and the unpacking unit 116.

At Step S225, quantization width zero setting processing R is performed.In the quantization width zero setting processing R, the surplus bitcount unit 115 issues quantization width zero change instruction to thequantization width setting unit 114. The quantization width zero changeinstruction R is instruction for setting the quantization width Qcorresponding to the to-be-decoded pixel, to “0”.

Then, the surplus bit counter updating processing R is completed, andthe processing returns to the image decoding processing in FIG. 10 againand proceeds to Step S219.

When the quantization width zero change instruction R is received, thequantization width setting unit 114 changes the quantization width Qcorresponding to the to-be-decoded pixel, to “0”.

At Step S219, coded pixel data obtainment processing R is performed.Here, since the unpacking unit 116 receives the counter decrement valueinformation R, in the coded pixel data obtainment processing R, thefollowing obtainment processing RB is performed.

In the obtainment processing RB, the unpacking unit 116 obtains a pieceof pixel data expressed by (reference bit width M+the value indicated bythe counter decrement value information R) bits, namely, a piece ofpixel data that is coded by consuming surplus bit(s), by reading thepiece of pixel data from the internal memory.

It is assumed that the reference bit width M is 8 bits. Furthermore, thevalue indicated by the counter decrement value information R is assumedto be “2”. Under the assumption, since a piece of pixel datacorresponding to the to-be-decoded pixel is a piece of pixel datacorresponding to the first pixel belonging to the group G2 shown in FIG.9B, the unpacking unit 116 obtains a piece of pixel data correspondingto the pixel P6, by reading, as the piece of pixel data corresponding tothe pixel P6, the first to tenth bits. Then, the unpacking unit 116provides the obtained piece of pixel data to the quantization widthsetting unit 114.

As described above, the value of the counter decrement value informationR is the number of available surplus bits. Therefore, if the valueindicated by the counter decrement value information R is “2”, a pieceof pixel data corresponding to the to-be-decoded pixel obtained byreading is a piece of data that is generated by using two surplus bits.

At Step S230, the same processing as described previously is performed,so that the details are not explained again. At the step, thequantization width Q of “0” corresponding to the to-be-decoded pixel,the obtained piece of pixel data, and the calculated prediction value of“320” of the to-be-decoded pixel are provided to the inversequantization processing unit 118 and the unpacking unit 116.

Then, at Step S231, decoding processing is performed. Here, since thequantization width Q provided from the quantization width setting unit114 indicates “0” and the inverse quantization processing unit 118receives the counter decrement value information R described later, thefollowing processing RB is performed in the decoding processing.

In the processing RB, the inverse quantization processing unit 118generates a piece of data (hereinafter, referred to as a “piece ofdecoded data”) that expresses the received piece of pixel data expressedby (reference bit width M+the value indicated by the counter decrementvalue information R) bits by a code-added binary digit number of adynamic range of the piece of pixel data received by the pixel datareceiving unit 101.

Then, the inverse quantization processing unit 118 provides thegenerated piece of decoded data to the output unit 119.

Here, it is assumed that a value indicated by the received piece ofpixel data is “270”. Under the assumption, the inverse quantizationprocessing unit 118 generates a piece of decoded data that expresses, by13 bits, the value of “270” that is indicated by 10 bits by the receivedpiece of pixel data.

Then, the determination at Step S232 is YES, and therefore Step S234 isperformed in the same manner as described previously. At the step, theoutput unit 119 obtains a piece of pixel data indicating a pixel valueof “320” of the pixel P5, and generates a piece of decoded pixel dataindicating a pixel value of “590” of the pixel P6. The output unit 119stores the generated piece of decoded pixel data into the externalmemory. In addition, the output unit 119 provides the generated piece ofdecoded pixel data to the unpacking unit 116.

Then, Step S235 described previously is performed to increment the valueof g by “1”, and then Step S214 is performed again.

Then, the processing proceeds to Step S215. At the steps, a predictionvalue of “590” of the to-be-decoded pixel is calculated.

Then, the determination at Step S216 is NO, and therefore the processingproceeds to Step S221 in FIG. 11. Here, the determination at Step S221is NO, and therefore the processing proceeds to Step S223.

Here, it is assumed that the value of the surplus bit counter RC is “1”.It is also assumed that the quantization width Q indicated in thereceived quantization information is “2”. Under the assumption, thedetermination at Step S223 is NO, and therefore the processing proceedsto Step S226.

At Step S226, quantization width change processing R is performed. Inthe quantization width change processing R, the surplus bit count unit115 issues quantization width change instruction R to the quantizationwidth setting unit 114. The quantization width change instruction R isinstruction for changing a quantization width Q (for example, “2”)corresponding to the to-be-decoded pixel, to a value generated bysubtracting the quantization width Q by a value (for example, “1”) ofthe surplus bit counter RC.

In receiving the quantization width change instruction R, thequantization width setting unit 114 changes the quantization width Q(for example, “2”) corresponding to the to-be-decoded pixel, to a valuegenerated by subtracting the quantization width Q by the value (forexample, “1”) of the surplus bit counter RC.

At Step S227, the surplus bit count unit 115 sets the value indicated bythe surplus bit counter RC to “0”.

Furthermore, the surplus bit count unit 115 provides the counterdecrement value information R to the quantization width setting unit114. The counter decrement value information R is information indicatinga value (for example, “1”) by which the value of the surplus bit counterRC is decremented. In this case, the counter decrement value informationR indicates the number of surplus bits available in the processingdescribed later.

When the counter decrement value information R is received, thequantization width setting unit 114 provides the received counterdecrement value information R to the inverse quantization processingunit 118 and the unpacking unit 116.

Then, the surplus bit counter updating processing R is completed, andthe processing returns to the image decoding processing in FIG. 10 againand proceeds to Step S219.

At Step S219, the obtainment processing RB as described previously isperformed. It is assumed that the reference bit width M is 8 bits.Furthermore, the value indicated by the counter decrement valueinformation R is assumed to be “1”. Under the assumption, since a pieceof pixel data corresponding to the to-be-decoded pixel is a piece ofpixel data corresponding to the second pixel belonging to the group G2shown in FIG. 9B, the unpacking unit 116 obtains a piece of pixel datacorresponding to the pixel P7, by reading, as the piece of pixel datacorresponding to the pixel P7, the first to ninth bits. Then, theunpacking unit 116 provides the obtained piece of pixel data to thequantization width setting unit 114.

As described above, the value of the counter decrement value informationR is the number of available surplus bits. Therefore, if the valueindicated by the counter decrement value information R is “1”, a pieceof pixel data corresponding to the to-be-decoded pixel obtained byreading is a piece of data that is generated by using one surplus bit.

At Step S230, the same processing as described previously is performed.At the step, the quantization width Q of “1” corresponding to theto-be-decoded pixel, the obtained piece of pixel data, and thecalculated prediction value of “590” of the to-be-decoded pixel areprovided to the inverse quantization processing unit 118.

At Step S231, the above-described decoding processing is performed.Here, it is assumed that the inverse quantization processing unit 118receives a quantization width Q of “1” from the quantization widthsetting unit 114, and receives the counter decrement value informationR. Under the assumption, the processing RB described below is performedin the decoding processing.

In the processing RB, as described previously, the inverse quantizationprocessing unit 118 generates a piece of data (hereinafter, referred toas a “piece of decoded data”) that expresses the received piece of dataexpressed by (reference bit width M+ the value indicated by the counterdecrement value information R) bits by a code-added binary digit numberof a dynamic range of the piece of pixel data received by the pixel datareceiving unit 101.

Here, it is assumed that a value indicated by the received piece ofpixel data is “−250”. Under the assumption, the inverse quantizationprocessing unit 118 generates a piece of decoded data that expresses, by13 bits, the value of “−250” indicated by the received piece of pixeldata.

Here, the determination at Step S232 is NO, and therefore the processingproceeds to Step S233. Hereinafter, a quantization width Q indicating avalue of 1 or greater is referred to as a “non-zero quantization widthQ”.

At Step S233, inverse quantization processing is performed. In theinverse quantization processing, the inverse quantization processingunit 118 inversely quantizes the value of the piece of decoded data, bymultiplying the value by the Q-th power of 2. Hereinafter, a valuegenerated by inverse quantization is referred to as an “inversequantized value”.

Here, it is assumed that a value indicated by the piece of decoded datais “−250”. It is also assumed that a quantization width Q correspondingto the to-be-decoded pixel indicates “1”. Under the assumption, theinverse quantization processing unit 118 obtains an inverse quantizedvalue of “−500”, by multiplying (a) “−250” that is the value indicatedby the obtained piece of pixel data by (b) the first power of 2 (2).

Then, the inverse quantization processing unit 118 provides the piece ofdecoded data indicating the inverse quantized value (for example,“−500”) to the output unit 119.

Then, Step S234 is performed in the same manner as described previously.At the step, the output unit 119 obtains a piece of pixel dataindicating a pixel value of “590” of the pixel P6, and generates a pieceof decoded pixel data indicating a pixel value of “90” of the pixel P7.The output unit 119 stores the generated piece of decoded pixel datainto the external memory. In addition, the output unit 119 provides thegenerated piece of decoded pixel data to the unpacking unit 116.

Then, Step S235 described previously is performed to increment the valueof g by “1”, and then Step S214 is performed again.

Then, at least a part of Steps S214 to S234 is repeated until thedetermination at Step S235 is YES.

If the determination at Step S235 is YES, then the processing proceedsto Step S237.

At Step S237, the surplus bit count unit 105 sets the value indicated bythe surplus bit counter to “0”.

At Step S238, the packing unit 116 determines whether or not thedecoding processing is completed for the entire to-be-decoded picture.If the determination at Step S238 is YES, then the image decodingprocessing is completed. On the other hand, if the determination at StepS238 is NO, then Step S213 is performed again.

Then, at least a part of Steps S213 to S237 is repeated until thedetermination at Step S238 is YES. Eventually, all pieces of coded datanecessary to reconstruct a picture are decoded.

It should be note that the image decoding processing according to thefirst embodiment may be implemented as hardware such as a Large ScaleIntegration (LSI).

As described above, in the image coding processing according to thefirst embodiment, if the number (code-added prediction difference binarynumber) of digits of binary data that expresses a prediction differencevalue of a pixel by code-added binary number is smaller than thereference bit width M, the prediction difference value is coded byleaving bit(s). Furthermore, if the code-added prediction differencebinary number is greater than the reference bit width M and there is anysurplus bit, the value is expressed by (reference bit width M+valueindicated by available surplus bit number).

Thereby, it is possible to eliminate the quantization processing, ordecrease the quantization width Q in the quantization processing. As aresult, it is possible to suppress deterioration of image quality due toquantization errors. In other words, it is possible to reduce a degreeof deterioration of image quality caused by coding.

In addition, in the first embodiment, pieces of coded data having thefixed bit width (s bits) are consecutively stored in the externalmemory. One piece of coded data includes pieces of coded pixel datanecessary for reconstructing a picture. Therefore, if it is required toaccess a certain piece of coded pixel data, it is necessary only toaccess a piece of coded data including the piece of coded pixel data.Therefore, random accessibility for the data can be kept.

Furthermore, the fixed bit width (s bits) is set to a bus width of datatransfer of a used integrated circuit. The fixed length of the bus widthcan be secured. Therefore, implementation is possible without losingrandom accessibility.

As described above, the first embodiment can reduce a degree ofdeterioration of image quality while keeping random accessibility.

Second Embodiment

In the second embodiment, description is given for an example of adigital still camera including the image coding device 100 and the imagedecoding device 110 which have been described in the first embodiment.

FIG. 12 is a block diagram showing a structure of a digital still camera1300 according to the second embodiment.

As shown in FIG. 12, the digital still camera 1300 includes the imagecoding device 100 and the image decoding device 110. Since thestructures and functions of the image coding device 100 and the imagedecoding device 110 have been described in the first embodiment, theywill not be described in detail again later.

The digital still camera 1300 includes an imaging unit 1310, an imageprocessing unit 1320, a display unit 1330, a compression conversion unit1340, a recording storing unit 1350, and a Synchronous Dynamic RandomAccess Memory (SDRAM) 1360.

The imaging unit 1310 captures image of an object and generates digitalimage data corresponding to the image. In this example, the imaging unit1310 includes an optical system 1311, an imaging device 1312, an AnalogFront End (abbreviated to AFE in FIG. 12) 1313, and a timing generator(abbreviated to TG in FIG. 12) 1314.

The optical system 1311 is a lens or the like which forms image of anobject onto the imaging device 1312. The imaging device 1312 convertslight incident from the optical system 1311 into electric signals.Examples of the imaging device 1312 are an imaging device using a ChargeCoupled Device (CCD), an imaging device using CMOS, and other variousimaging devices.

The analog front end 1313 performs signal processing such as noisecancellation, signal amplification, analog/digital conversion for analogsignals provided from the imaging device 1312. Then, the analog frontend 1313 generates image data indicating data obtained by the abovesignal processing. The generated image data consists of plural pieces ofpixel data. The piece of piece of pixel data is RAW data.

The timing generator 1314 provides clock signals to the imaging device1312 and the analog front end 1313. Based on the clock signals, theimaging device 1312 and the analog front end 1313 perform theiroperations.

The image processing unit 1320 performs predetermined image processingfor the pieces of pixel data (RAW data) provided from the imaging unit1310. Then, the image processing unit 1320 provides the pieces of pixeldata (RAW data), for which the image processing have been performed, tothe image coding device 100.

As shown in FIG. 12, the image processing unit 1320 generally includes awhite balance circuit (abbreviated to WB in FIG. 12) 1321, a luminancesignal generation circuit 1322, a color separation circuit 1323, anaperture correction processing circuit (abbreviated to AP in FIG. 12)1324, a matrix processing circuit 1325, and a zoom circuit (abbreviatedto ZOM in FIG. 12) 1326 that enlarges and reduces image.

The white balance circuit 1321 is a circuit that corrects colorcomponents, which are generated using a color filter of the imagingdevice 1312, to have a correct ratio, so that a white object is imagedas white under any light source.

The luminance signal generation circuit 1322 generates luminance signals(Y signals) from RAW data. The color separation circuit 1323 generatescolor difference signals (Cr/Cb signals) from RAW data.

The aperture correction processing circuit 1324 performs processing toincrease a resolution by adding high-frequency components to luminancesignals generated by the luminance signal generation circuit 1322. Thematrix processing circuit 1325 adjusts, for the data provided from thecolor separation circuit 1323, hue balance that has been lost due tospectral characteristics of the imaging device or image processing.

In general, the image processing unit 1320 commonly temporarily stores apiece of pixel data to be processed into a memory such as a SDRAM, thenperforms predetermined image processing, YC signal (luminance signal orcolor difference signal) generation, zoom processing, and the like forthe data temporarily stored, and temporarily stores the resultingprocessed data again into the SDRAM.

Therefore, it is considered that the image processing unit 1320 performsprocessing for providing data to the image coding device 100 andprocessing for receiving data from the image decoding device 110.

The display unit 1330 displays image data (decoded image data) providedfrom the image decoding device 110.

The compression conversion unit 1340 performs, according to apredetermined standard, compression-conversion for the image dataprovided from the image decoding device 110, and provides the resultingconverted JPEG image data to the recording storing unit 1350.Furthermore, the compression conversion unit 1340 performsdecompression-conversion for the JPEG image data that is read out fromthe recording storing unit 1350, and provides the resulting converteddata to the image coding device 100.

In other words, the compression conversion unit 1340 can process datacompliant with JPEG standard. Such compression conversion unit 1340 isgenerally embedded in a digital still camera.

The recording storing unit 1350 receives compressed image data andrecords the image data onto a recording medium (such as a nonvolatilememory). In addition, the recording storing unit 1350 reads thecompressed image data from the recording medium, and provides the imagedata to the compression conversion unit 1340.

It should be noted that data processed by the image coding device 100and the image decoding device 110 according to the second embodiment isnot limited to RAW data. For example, the data processed by the imagecoding device 100 and the image decoding device 110 may be data of YCsignal (luminance signal or color difference signal) that is generatedfrom RAW data by the image processing unit 1320, or data (luminancesignal data or color difference signal data) that is generated bydecompressing JPEG image data that has been compression-converted toJPEG or the like, for example.

As described above, the digital still camera 1300 according to thesecond embodiment includes the image coding device 100 and the imagedecoding device 110 which process RAW data, YC signals, and the like, inaddition to the compression conversion unit 1340 that is generallyembedded in a digital still camera.

Thereby, the digital still camera 1300 according to the secondembodiment can perform high-speed imaging operation increasing thenumber of consecutive pictures having the same resolution, while havingthe same memory capacity. In addition, the digital still camera 1300 canincrease a resolution of moving pictures which are stored in a memoryhaving the same capacity.

Furthermore, the structure of the digital still camera 1300 described inthe second embodiment can also be applied to a structure of a digitalcamcorder that includes an imaging unit, an image processing unit, adisplay unit, a compression-conversion unit, a recording storage unit,and a SDRAM as the digital still camera 1300 does.

First Variation of Second Embodiment

It should be noted that, when a piece of pixel data provided from theimage processing unit 1320 to the image coding device 100 is YC signal(luminance signal or color difference signal) data, it is also possibleto perform coding of color difference signal data prior to coding of theluminance signal data in processing of generating data having a fixedbit width (s bits) set by the fixed bit width setting unit 107 inFIG. 1. The YC signal data is data converted in the image processingunit 1320.

Color difference signals do not have any sharp edge in comparison toluminance signal, since high-frequency components have been lost in astage of being generated in the image processing unit 1320. Therefore,regarding color difference signals, it is expected that a predictionaccuracy of a prediction value corresponding to a to-be-coded pixel ishigh and a quantization width Q is low. Thereby, it is considered that avalue of the surplus bit counter is likely to be incremented for colordifference signals.

Therefore, if coding of color difference signal data is performed priorto coding of the luminance signal data in the processing of generatingdata having the fixed bit width (s bits), a large number of surplus bitsare produced. Thereby, it is possible to allocate more bits in codingluminance signal data that is visually sensitive. As a result, it ispossible to code pixel data while suppressing visual deterioration.

Second Variation of Second Embodiment

In the second variation of the second embodiment, description is givenfor a variation where, when a piece of pixel data provided from theimage processing unit 1320 to the image coding device 100 is YC signal(luminance signal or color difference signal) data, IQ axes conversionis performed on the color difference signal data to be coded.

IQ signal, on which the IQ axes conversion has been performed, isgenerated by modulating color difference signal. The IQ signal isexpressed by the following equations.

I=0.6R−0.28G−0.32B   (Equation 9)

Q=0.21R−0.52G+0.31B   (Equation 10)

In the equations (9) and (10), R represents red signal component ofcolor difference signal, G represents green signal component of colordifference signal, and B represents blue signal component of colordifference signal.

The IQ signal generated in the above modulation is a signal thatsimplifies color difference signals by human visual characteristics. Ifan I axis is set to an “orange-cyanogen axis” having the highestresolution for human eyes in the chromaticity diagram, I signal is usedto be propagated in a wide band because I signal deals in detail. If a Qaxis is set to an “yellow-magenta axis” which is perpendicular to the Iaxis and has the lowest resolution for human eyes in the chromaticitydiagram, Q signal is used to be propagated in a narrow band.

In other words, even if an information amount of Q signal is restrictedto some extend, it is possible to achieve propagation with reducedvisual image quality deterioration. Therefore, by modulating colordifference signal to IQ signal in the image coding device 100, it ispossible to decrease the number of bits for the Q signal as much aspossible, and allocate the bits to luminance signal that is sensitivefor human eyes.

More specifically, as shown in FIG. 13A, Q signal is allocated to thegroup G1, and a bit width, which is generated by subtracting “1” fromthe reference bit width M, is ensured for a piece of coded pixel data ofthe Q signal. Redundant bits are previously ensured as surplus bits, forthe number of pixels of Q signal which are packed in data having thefixed bit width (s bits) set by the fixed bit width setting unit 107.

Furthermore, as described in the first variation of the secondembodiment, color signal is prioritized to be coded first among the datahaving the fixed bit width (s bits) (I signal is allocated to the groupG2). Thereby, it is possible to prevent consumption of surplus bits, andto allocate, as much as possible, surplus bits to luminance signal thatis visually sensitive.

As shown in FIG. 13A, if I signal is allocated to the group G2, surplusbits are neither increased nor decreased. However, it is considered thatsurplus bits are consumed (used) if components of I signal have a sharpchange, and that the number of accumulated surplus bits is increased ifthe components have no change.

It is assumed in FIG. 13A that, for I signal, there is no input of pixeldata that changes a value of the surplus bit counter. By allocatingluminance signal to a later part of the group, it is possible to use allof increasing surplus bits for the luminance signal. This means thatluminance signal data is coded by using surplus bits. As a result, it ispossible to code pixel data while suppressing visual deterioration.

Furthermore, since increased or decreased surplus bit(s) and a bit widthof a piece of coded pixel data which is generate by consuming surplusbit(s) depend on an input piece of piece of pixel data, they are shownas “*” in FIG. 13A.

It should be noted that it is possible to previously allocate bit(s)caused by decrease of a bit width of a piece of coded pixel data of Qsignal, to a bit width of a piece of coded pixel data of luminancesignal. More specifically, if a bit width of a piece of coded pixel dataof Q signal is generated by subtracting “1” from the reference bit widthM, it is possible to express luminance signal, which is packed in datahaving the same fixed bit width (s bits), by a bit width (reference bitwidth M+1).

The reference bit width M in the above case is shown in FIG. 13B. Asshown in FIG. 13B, in the second variation of the second embodiment, itis possible to previously allocate more bits to luminance signal that isvisually sensitive, without prioritizing coding of color signal to beperformed first among the data having the fixed bit width (s bits). As aresult, it is possible to code pixel data while suppressing visualdeterioration.

Third Embodiment

In the third embodiment, description is given for an example where eachof the image coding device and the image decoding device, which havebeen described in the first embodiment, further includes a surplus bitcontrol unit.

FIG. 14 is a block diagram showing structures of an image coding device100A and an image decoding device 110A according to the thirdembodiment.

As shown in FIG. 14, the image coding device 100A differs from the imagecoding device 100 in FIG. 1 in further including a surplus bit controlunit 109. Except the difference, the image coding device 100A is thesame as the image coding device 100, and therefore the detaileddescription of the image coding device 100A is not repeated below. Inaddition, the image decoding device 110A differs from the image decodingdevice 110 in FIG. 1 in further including a surplus bit control unit111. Except the difference, the image decoding device 110A is the sameas the image decoding device 110, and therefore the detailed descriptionof the image decoding device 110A is not repeated below.

(Coding Processing)

First, image coding processing in the case where the number of usedsurplus bits is not controlled is described.

Each of FIGS. 15A and 15B is a diagram for explaining the image codingprocessing in the case where the number of used surplus bits is notcontrolled.

FIG. 15A shows, as an example, 11 pieces of pixel data among 26 piecesof pixel data which are provided into the pixel data receiving unit 101.Each item shown in FIG. 15A are the same as explained with reference toFIG. 9A, and will not be therefore explained again.

It is assumed that the pixel data receiving unit 101 receives pieces of12-bit pixel data corresponding to respective pixels in an order of thepixel P1, P2, . . . , P11. A numeral value indicated in each of thepixels P1 to P11 is a pixel value indicated in each piece of pixel data.It is also assumed that the pixel data corresponding to the pixel P1 isan initial pixel value data of green, and that the pixel datacorresponding to the pixel P2 is an initial pixel value data of red.

In this example, a prediction value of a to-be-coded pixel is calculatedby using the previously-described prediction equation (1). In otherword, a prediction value of a to-be-coded pixel is a pixel value of apixel on the immediately left of the to-be-coded pixel. Furthermore, inthis example, a value (prediction difference value) of a differencebetween (a) a pixel value of the to-be-coded pixel and (b) the pixelvalue of the pixel on the immediately left of the to-be-coded pixel isquantized.

Moreover, in this example, a relationship among quantization widthinformation Code, a prediction difference absolute value, a quantizationwidth Q, and a surplus bit number is referred to the data table DT110 inFIG. 8.

The quantization width Q is, as described in the first embodiment,calculated from a maximum prediction difference absolute value that iscalculated from prediction difference values of neighboring three pixelsbelonging to each group. The three pixels belonging to each group arequantized by the same quantization width Q.

FIG. 15B is a diagram showing a piece of pixel data (coded pixel data)that is generated by coding processing of the image coding device 100A.In FIG. 15B, a numeral value indicated in each piece of coded pixel dataindicates the number of bits of the piece of coded pixel data.

In the image coding processing of this example, the same processing asdescribed in the first embodiment is performed, so that a quantizationwidth Q corresponding to three pixels belonging to the group G1 is setto “0”. Therefore, a code of “000” is selected for quantization widthinformation Code. Therefore, after coding prediction difference valuesof the three pixels belonging to the group G1, 6 surplus bits areproduced. For each of the three pixels, a piece of coded pixel data canbe expressed by 6 bits.

In each of the groups G2 and G3, there are a plurality of sharp levelchanges of pixel values. A quantization width Q is set to “4” in each ofthe groups G2 and G3.

However, when a prediction difference value corresponding to the pixelP6 (pixel value of “1590”), 4 surplus bits are used (consumed). Inaddition, when a prediction difference value corresponding to the nextpixel P7 (pixel value of “2000”), 2 surplus bits are used (consumed).Therefore, at this timing, the accumulated surplus bit number is “0”.

Therefore, after that, subsequent sharp edges are not solved at all, andcoding is performed with the reference bit width M.

Each of FIGS. 16A and 16B is a diagram for explaining the image codingprocessing in the case where the number of used surplus bits iscontrolled.

FIG. 16A shows, as an example, 11 pieces of pixel data among 26 piecesof pixel data which are provided into the pixel data receiving unit 101.It should be noted that the 11 pieces of pixel data shown in FIG. 16Aare the same as the 11 pieces of pixel data shown in FIG. 15A. Thepixels except the pixels P1 and P2 shown in FIG. 16A are to-be-codedpixels that are to be coded.

The processing in the third embodiment is performed for the group G1under the same conditions, and therefore 6 surplus bits are produced.The third embodiment is characterized in that the surplus bit controlunit 109 controls the number (a value of the surplus bit counter) ofused surplus bits so that local quantization errors are distributed.

In the third embodiment, the processing for controlling used surplusbits is referred to as “surplus bit control processing”. It is assumedthat the following processing is performed first prior to the surplusbit control processing.

First, the quantization width setting unit 104 provides the surplus bitcontrol unit 109 with information of a quantization width Q of eachgroup in data having a fixed bit width (s bits).

The surplus bit control unit 109 measures an occurrence frequency ofprediction errors from the received information of the quantizationwidth Q of each group. In the processing, how many surplus bits are tobe ensured for each group is estimated.

For example, if the pieces of pixel data shown in FIG. 16A are providedto the image coding device 100A, the quantization width setting unit 104provides the surplus bit control unit 109 with codes of “000”, “110”,and “110” which are pieces of quantization width information Code.

Then, the surplus bit control processing is performed.

FIG. 17 is a flowchart of the surplus bit control processing.

The surplus bit control unit 109 receives the codes of “000”, “110”, and“110” which are pieces of quantization width information Code, andthereby determines that 2 surplus bits per one pixel are produced in thegroup G1. Therefore, the value of the surplus bit counter is increasedto be 6 (S501, S502).

In each of the group G2 and G3, a corresponding quantization width Q isgreater than “0”. Therefore, prior to quantization, the surplus bitcontrol unit 109 can predict that surplus bit(s) is to be used(consumed) (S503). Therefore, in the surplus bit control processing,instruction to consume a half (three bits) of the 6 surplus bits foreach of the group G2 and the group G3 is issued to the surplus bit countunit 105 (S504).

In addition, a maximum bit number of surplus bits which can be consumedin single coding processing (including quantization processing) ispreviously determined. Thereby, it is possible to distribute consumptionof surplus bits in a group. More specifically, a maximum bit number ofsurplus bits which can be consumed in single coding processing ispreviously determined to be 2 bits. In this case, when a predictiondifference value corresponding to the pixel P6 in FIG. 15A is to becoded, 2 surplus bits, which are the maximum bit number, are consumed.

When a prediction difference value corresponding to the pixel P7 next tothe pixel P6 is to be coded, there are 4 surplus bits and the number ofsurplus bits consumable in the group G2 is one. Therefore, when theprediction difference value corresponding to the pixel P7 is to becoded, one surplus bit is used (consumed).

When a prediction difference value corresponding to the pixel P8 is tobe coded, there are 3 surplus bits. However, since the number of thesurplus bits exceeds the number of surplus bits consumable in the groupG2, the surplus bits are not consumed for quantization in this case.

Also in the group G3, three surplus bits can be consumed. Therefore,when the prediction difference value corresponding to the pixel P9 is tobe coded, 2 surplus bits, which is a maximum bit number, is consumed.When a prediction difference value corresponding to the pixel P10 is tobe coded, there is one surplus bit and therefore the quantization widthQ can be decremented by “1”.

When a prediction difference value corresponding to the pixel P11belonging to the group G3 is to be coded, there is no more surplus bitand therefore any surplus bit is not used in coding the predictiondifference value.

In the example of FIG. 16A, since the quantization width Q of the groupG2 is the same as the quantization width Q of the group G3, a pluralityof produced surplus bits are divided into halves to be allocated.

It should be noted in Step S504 in FIG. 17 that surplus bits may beallocated based on a quantization width of a group consuming the surplusbits so that more surplus bits are allocated for a greater quantizationwidth.

Next, description is given for processing (hereinafter, referred to as“surplus bit counter updating processing A”) for updating the surplusbit counter which is performed by the surplus bit count unit 105 in thethird embodiment.

The surplus bit counter updating processing A is processing performedinstead of the surplus bit counter updating processing at Step S120 inthe image coding processing in FIG. 2.

FIG. 18 is a flowchart of the surplus bit counter updating processing A.As shown in FIG. 18, the surplus bit counter updating processing Adiffers from the surplus bit counter updating processing in FIG. 3 inthat Step S123A is performed instead of Step S123, and that Steps S123B,S123C, S123D, and S123E are further performed.

It should be noted that the same step numerals in FIG. 3 assigned to thesteps described in the first embodiment are assigned to the identicalsteps in FIG. 18, so that the details are not explained again.

First, Step S123A, which is performed when consumption of surplus bit(s)is necessary, differs from Step S123 in adding a determination as towhether or not there is any surplus bit consumable in the same group. Inother words, Step S123A controls the number of surplus bits not toexceed the number of surplus bits consumable in the group.

Next, Step S123B determines whether or not the number of surplus bits isgreater than a consumable maximum bit number. If the number of surplusbits is greater than the consumable maximum bit number (YES at S123B),then the surplus bit count unit 105 updates the value of the surplus bitcounter to be the consumable maximum bit number (S123C). Thereby,control is performed to distribute consumption of surplus bits in thegroup.

Next, at Step S123D, the surplus bit count unit 105 decrements the valueof the surplus bit counter by the number of consumed surplus bits amongthe number of consumable surplus bits in the same group. At the step,when a prediction difference value corresponding to a next pixel in thesame group is to be coded, a threshold value is updated not to exceedthe number of consumable surplus bits in the group.

Next, if the determination at Step S123B is made that the number ofsurplus bits is greater than the maximum consumable bit number (YES atS123B), then, at Step S123E, the surplus bit count unit 105 updates thevalue of the surplus bit counter, which has been updated to the maximumconsumable bit number, to the previous surplus bit number (a totalnumber of holding surplus bits).

In the first embodiment, quantization errors are suppressed in an orderof occurrence. However, in the third embodiment, the surplus bit controlunit 109 predicts pieces of pixel data in data having the fixed bitwidth (s bits). By the processing, quantization errors are not locallysolved, but quantization errors can be suppressed as much as possiblewithin a range of available surplus bits, and can be distributed.

(Decoding Processing Performed by Image Decoding Device 110A)

In the decoding processing in the third embodiment, the unpacking unit116 separates obtained data into a piece of initial pixel value data,pieces of coded pixel data, and quantization width information Code.Therefore, the surplus bit control unit 111 in the image decoding device110A previously obtains only the quantization width information Code. Bythe processing, the surplus bit control unit 111 can easily estimate howmany surplus bits are to be ensured for each group.

The control processing of the surplus bit control unit 111 is the sameas the surplus bit control unit 109 described with reference to FIG. 17,so that the description is not repeated in detail below.

First Variation of Third Embodiment

In the third embodiment, the surplus bit control unit 109 obtains, fromthe quantization width setting unit 104, information of a quantizationwidth Q of each group among the data having the fixed bit width (sbits). By the processing, the surplus bit control unit 109 estimates howmany surplus bits are to be ensured for each group in data having thefixed bit width.

However, in the above method, as shown in FIG. 17, it is impossible todetermine surplus bits to be allocated to each group until allprediction processing of the quantization width Q in data having thefixed bit width has been completed. Therefore, in the image codingprocessing, processing delay occurs.

Therefore, it is possible to previously determine only a maximumconsumable bit number per one quantization, without predicting aquantization width Q in data having the fixed bit width. Thereby, it ispossible to distribute local quantization errors in data having thefixed bit width.

However, according to the first variation of the third embodiment, evenif there is only one sharp change in pixel data to be included in datahaving the fixed bit width, there are disadvantages that the number ofconsuming surplus bits is restricted.

Therefore, in the coding processing, it is possible to switch betweenthe third embodiment and the first variation depending on necessity.

Fourth Embodiment

In the fourth embodiment, description is given for an example of astructure of a digital still camera in the case where an imaging deviceprovided in the digital still camera includes an image coding device.

FIG. 19 is a block diagram showing a structure of the digital stillcamera 2000 according to the fourth embodiment. As shown in FIG. 19, thedigital still camera 2000 differs from the digital still camera 1300 inFIG. 12 in that an imaging unit 1310A is included instead of the imagingunit 1310, and that an image processing unit 1320A is included insteadof the image processing unit 1320. Other units in the structure are thesame as those in the digital still camera 1300, so that they are notdescribed in detail again below.

The imaging unit 1310A differs from the imaging unit 1310 in FIG. 12 inthat an imaging device 1312A is included instead of the imaging device1312. Other units in the structure are the same as those in the imagingunit 1310, so that they are not described in detail again below. Theimaging device 1312A includes the image coding device 100 shown in FIG.1.

Furthermore, the image processing unit 1320A differs from the imageprocessing unit 1320 in FIG. 12 in that the image decoding device 110 inFIG. 1 is further included. Other units in the structure are the same asthose in the image processing unit 1320, so that they are not describedin detail again below.

The image coding device 100 included in the imaging device 1312A codespixel signals generated by the imaging device 1312A, and provides theresulting coded data to the image decoding device 110 in the imageprocessing unit 1320A.

The image decoding device 110 in the image processing unit 1320A decodesthe data provided from the image coding device 100. By the processing,it is possible to improve efficiency of data transfer between theimaging device 1312A and the image processing unit 1320A in anintegrated circuit.

Therefore, the digital still camera 2000 according to the fourthembodiment can perform, better than the digital still camera 1300according to the second embodiment, high-speed imaging operations suchas an operation for increasing the number of consecutive pictures havingthe same resolution, an operation for increasing a resolution of movingpictures, for example, while having the same memory capacity.

Fifth Embodiment

In general, printer apparatuses are required to print print objects witha higher accuracy and at a higher speed. Therefore, the followingprocessing is commonly performed.

First, a personal computer performs compression-coding for digital imagedata to be printed, and provides the resulting coded data to a printer.Then, the printer decodes the received coded data.

Here, in the fifth embodiment, the image coding device 100 according tothe first embodiment is embedded in the personal computer, and the imagedecoding device 110 according to the first embodiment is embedded in theprinter, so that image quality deterioration of printed objects can besuppressed.

FIG. 20 is a diagram showing the personal computer 300 and the printer4000 according to the fifth embodiment. As shown in FIG. 20, thepersonal computer 3000 includes the image coding device 100. The printer4000 includes the image decoding device 110.

Recently, image indicated by image data to be printed includes variousdata such as characters, figures, and natural images, as seen in aposter, an advertisement, or the like. Regarding such image, when dataof image indicating characters or a figure which is expressed by asingle color is provided to the image coding device 100 in the personalcomputer 3000, there is a high possibility of causing surplus bits.

The image coding device 100 codes image by using the caused surplusbits. Thereby, it is possible to suppress quantization errors in thecase where sharp concentration change, which results in a boundarybetween characters or figures and natural image, occurs in data having afixed bit width.

It should also be noted that the embodiments disclosed above are merelyexemplary in every aspect and do not limit the present invention. Thescope of the present invention is indicated not by the above descriptionbut by the appended claims. Any modifications in the embodiments areintended to have the same meaning and be included within the scope ofthe claims.

INDUSTRIAL APPLICABILITY

The image coding device and the image decoding device according to thepresent invention can perform variable length coding in each transferunit, which ensuring a fixed length of a bus width of data transfer ofan integrated circuit. Thereby, the present invention allows anapparatus dealing image, such as digital still cameras, network cameras,and printers, to code and decode image data while preventing imagequality deterioration, still keeping random accessibility. Therefore,the present invention is useful to deal with the recent increase ofimage data processing amount.

Numerical References

-   100, 100A image coding device-   102 prediction value calculation unit-   103 difference calculation unit-   104, 114 quantization width setting unit-   105, 115 surplus bit count unit-   106 packing unit-   107, 117 fixed bit width setting unit-   108 quantization processing unit-   109, 111 surplus bit control unit-   110, 110A image decoding device-   116 unpacking unit-   118 inverse quantization processing unit-   119 output unit-   1300, 2000 digital still camera-   1310, 1310A imaging unit-   1312, 1312A imaging device-   1320, 1320A image processing unit-   3000 personal computer-   4000 printer

1. An image coding device that codes image, said image coding deviceperforming coding processing for coding image, the image including aplurality of pixels which are previously ordered, the coding processingincluding: when a digit number B of binary data of a difference valuebetween (a) a value of a to-be-coded pixel that is a pixel to be codedand (b) a prediction value that is a value generated by predicting thevalue of the to-be-coded pixel is smaller than a predetermined bitnumber M, processing of coding the difference value corresponding to thedigit number B smaller than M by leaving 3 surplus bit which arecalculated by M−B; and when the digit number B is greater than M andthere are K surplus bit, processing of coding the difference valuecorresponding to the digit number B greater than M by using L surplusbit, where L≦K, and said image coding device generating pieces of codeddata each having a predetermined coding amount, by performing processingfor each of consecutive T pixels, where T≧2, among the plurality ofpixels so as to perform the coding processing for each of U pixels,where U≦T, among the consecutive T pixels, wherein the pieces of codeddata each having the predetermined coding amount are pieces of datanecessary to reconstruct the image, and each of the pieces of coded dataeach having the predetermined coding amount is a piece of data necessaryto reconstruct the corresponding T pixels.
 2. The image coding deviceaccording to claim 1, comprising: a setting unit configured to set thepredetermined coding amount; a prediction value calculation unitconfigured to calculate the prediction value by using a pixel value ofat least one neighboring pixel of the to-be-coded pixel; a differencecalculation unit configured to calculate the difference value betweenthe value of the to-be-coded pixel and the calculated prediction value;a quantization width setting unit configured to set a quantization widthvalue based on the digit number B of the binary data that expresses thecalculated difference value by code-added binary number, thequantization width value being used in quantization of the differencevalue; a bit count unit configured to increment a value of a bit counterindicating the number of the surplus bits when the digit number B issmaller than M, and decrement the value of the bit counter when thedigit number B is greater than M; and a quantization processing unitconfigured to (i) update the value of the bit counter to be a valuesmaller than the quantization width value set by said quantization widthsetting unit when said bit count unit decrements the value of the bitcounter, (ii) perform quantization processing for quantizing thedifference value after the updating, and (iii) codes a value resultingfrom the quantization processing.
 3. The image coding device accordingto claim 1, said image coding device generating U pieces of data byperforming the coding processing for each of the U pixels among theconsecutive T pixels, and said image coding device comprising a packingunit configured to generate the coded data having the predeterminedcoding amount including the U pieces of data, by using the generated Upieces of data.
 4. The image coding device according to claim 1, whereinthe coding processing is processing of (i) coding the difference valuecorresponding to the digit number B smaller than M when the digit numberB is smaller than M, and (ii) coding the difference value correspondingto the digit number B greater than M by using the L surplus bit to have(M+L) bits when the digit number B is greater than M and there are the Ksurplus bit.
 5. The image coding device according to claim 2, whereinsaid bit count unit is configured to set the value of the bit counter to“0”, each time one piece of the coded data having the predeterminedcoding amount is generated.
 6. The image coding device according toclaim 2, wherein the value of the bit counter is a positive value equalto or greater than
 0. 7. The image coding device according to claim 2,wherein a value of a surplus bit used by said quantization processingunit in the quantization processing is equal to or smaller than thequantization width value set by said quantization width setting unit. 8.The image coding device according to claim 2, wherein each of the piecesof coded data each having the predetermined coding amount includes: atleast one piece of information indicating the quantization width valueset by said quantization width setting unit; and at least one piece ofdata that is coded.
 9. The image coding device according to claim 1,wherein a piece of pixel data indicating the value of the to-be-codedpixel is RAW data provided from an external imaging device.
 10. Theimage coding device according to claim 1, wherein a piece of pixel dataindicating the value of the to-be-coded pixel is one of luminance signaldata and color difference signal data which are generated from RAW dataprovided from an external imaging device.
 11. The image coding deviceaccording to claim 1, wherein a piece of pixel data indicating the valueof the to-be-coded pixel is one of luminance signal data and colordifference signal data which are generated by decompressing image datagenerated by Joint Photographic Experts Group (JPEG) standard.
 12. Theimage coding device according to claim 10, wherein, when a piece ofpixel data indicating the value of the to-be-coded pixel is one of theluminance signal data and the color difference signal data, the colordifference signal data is coded prior to the luminance signal data inprocessing of generating the coded data having the predetermined codingamount.
 13. The image coding device according to claim 10, wherein, whena piece of pixel data indicating the value of the to-be-coded pixel isone of the luminance signal data and the color difference signal data,IQ axes conversion is performed on the color difference signal data toset the number of bits allocated to Q signal to be E, where E is anatural number smaller than M, so that F bit, where F is a naturalnumber, which are calculated by M−E, are left as surplus bits, and theluminance signal data are coded by using the surplus bit.
 14. The imagecoding device according to claim 10, wherein, when a piece of pixel dataindicating the value of the to-be-coded pixel is one of the luminancesignal data and the color difference signal data, IQ axes conversion isperformed on the color difference signal data to set the number of bitsallocated to Q signal to be E, where E is a natural number smaller thanM, and the luminance signal data are coded by W bit, where W is anatural number greater than M, which are allocated to the luminancesignal data.
 15. The image coding device according to claim 2, furthercomprising a surplus bit control unit configured to (i) calculate, priorto the coding processing, a difference between the prediction value anda value of every to-be-coded pixel to be included in each of the piecesof coded data each having the predetermined coding amount, (ii) measurean occurrence frequency of a prediction difference, and (iii) controlsurplus bits used in the coding processing so that local quantizationerrors are distributed within each of the pieces of coded data eachhaving the predetermined coding amount.
 16. The image coding deviceaccording to claim 2, further comprising a maximum use bit setting unitconfigured to control a surplus bit used in the coding, by designating amaximum number of the surplus bit available in coding of one to-be-codedpixel.
 17. A digital still camera comprising the image coding deviceaccording to claim
 1. 18. An imaging device comprising the image codingdevice according to claim
 1. 19. An image coding method of coding image,said image coding method comprising performing coding processing forcoding image, wherein the image including a plurality of pixels whichare previously ordered, the coding processing including: when a digitnumber B of binary data of a difference value between (a) a value of ato-be-coded pixel that is a pixel to be coded and (b) a prediction valuethat is a value generated by predicting the value of the to-be-codedpixel is smaller than a predetermined bit number M, processing of codingthe difference value corresponding to the digit number B smaller than Mby leaving J surplus bit which are calculated by M−B; and when the digitnumber B is greater than M and there are K surplus bit, processing ofcoding the difference value corresponding to the digit number B greaterthan M by using L surplus bit, where L≦K, and said image coding methodfurther comprising generating pieces of coded data each having apredetermined coding amount, by performing processing for each ofconsecutive T pixels, where T≧2, among the plurality of pixels so as toperform the coding processing for each of U pixels, where U≦T, among theconsecutive T pixels, wherein the pieces of coded data each having thepredetermined coding amount are pieces of data necessary to reconstructthe image, and each of the pieces of coded data each having thepredetermined coding amount is a piece of data necessary to reconstructthe corresponding T pixels.
 20. The image coding method according toclaim 19, said image coding method further comprising setting thepredetermined coding amount; calculating the prediction value by using apixel value of at least one neighboring pixel of the to-be-coded pixel;calculating the difference value between the value of the to-be-codedpixel and the calculated prediction value; setting a quantization widthvalue based on the digit number B of the binary data that expresses thecalculated difference value by code-added binary number, thequantization width value being used in quantization of the differencevalue; incrementing a value of a bit counter indicating the number ofthe surplus bits when the digit number B is smaller than M, anddecrementing the value of the bit counter when the digit number B isgreater than M; and (i) updating the value of the bit counter to be avalue smaller than the quantization width value set in said setting whensaid bit count unit decrements the value of the bit counter, (ii)performing quantization processing for quantizing the difference valueafter the updating, and (iii) coding a value resulting from thequantization processing.